django-imagekit
django-imagekit copied to clipboard
Allow to process truncated jpegs
Suddenly i got “IOError: image file truncated” with big images on some of my sites.
Site editor find this truncated jpeg somewhere in the internet and upload it on site. So, in debug=false mode we got nothing from imagekit, with debug=true we got error "file truncated".
I dont know how often encountered truncated jpegs (and how dangerous it is), but i think, that adding this Pillow option will be good idea:
from PIL import ImageFile
ImageFile.LOAD_TRUNCATED_IMAGES = True
Probably, if it dangerous, Imagekit setting param will be ok?
My software versions:
Django==1.8.4
django-imagekit==3.2.7
pilkit==1.1.13
Pillow==3.0.0
This is truncated jpeg (photoshop also throw error when i trying to open this):

Thanks!
I'm not sure if django-imagekit is the right place to put this. You can put it somewhere in your project in order to work.
The main problem is that the original image is broken and I'm not sure that django-imagekit need to take care of broken images. Probably there is a reason why this is not enabled by default.