Skip to content

Commit 34bc1e0

Browse files
webtweakerscodingjoe
authored andcommitted
Attempt to circumvent "OSError: image file is truncated" issue. (#184)
as detailed here: python-pillow/Pillow#1510
1 parent 3a72208 commit 34bc1e0

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

stdimage/models.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
from django.db.models.fields.files import (
99
ImageField, ImageFieldFile, ImageFileDescriptor
1010
)
11-
from PIL import Image, ImageOps
11+
from PIL import Image, ImageFile, ImageOps
1212

1313
from .validators import MinSizeValidator
1414

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

7070
resample = variation['resample']
7171

72+
ImageFile.LOAD_TRUNCATED_IMAGES = True
7273
with storage.open(file_name) as f:
7374
with Image.open(f) as img:
7475
save_kargs = {}

0 commit comments

Comments
 (0)