Skip to content

Commit

Permalink
Attempt to circumvent "OSError: image file is truncated" issue. (#184)
Browse files Browse the repository at this point in the history
as detailed here: python-pillow/Pillow#1510
  • Loading branch information
webtweakers authored and codingjoe committed Mar 1, 2018
1 parent 3a72208 commit 34bc1e0
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion stdimage/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from django.db.models.fields.files import (
ImageField, ImageFieldFile, ImageFileDescriptor
)
from PIL import Image, ImageOps
from PIL import Image, ImageFile, ImageOps

from .validators import MinSizeValidator

Expand Down Expand Up @@ -69,6 +69,7 @@ def render_variation(cls, file_name, variation, replace=False,

resample = variation['resample']

ImageFile.LOAD_TRUNCATED_IMAGES = True
with storage.open(file_name) as f:
with Image.open(f) as img:
save_kargs = {}
Expand Down

0 comments on commit 34bc1e0

Please sign in to comment.