wagtail / Willow

A wrapper that combines the functionality of multiple Python image libraries into one API
https://willow.wagtail.org/
BSD 3-Clause "New" or "Revised" License
273 stars 53 forks source link

Willow auto_orient() on jpeg images with No color-space metadata and no embedded color profile fails #41

Closed pringlewood closed 8 years ago

pringlewood commented 8 years ago

Hey @kaedroho

We are noticing some strange behaviour with willow on jpeg images when calling auto_orient(). It seems to fail on images without colour space metadata or colour profiles. Its hard to replicate if you do not have the correct image (attached below)

To replicate:

Python 3.4.3 (default, Jan 16 2016, 10:01:29)

from willow.image import Image f = open('IMG_20160602_013511.jpg', 'rb') img = Image.open(f) img.auto_orient() Traceback (most recent call last): File "", line 1, in File "/Users/wayne/workspace/cms/venv/lib/python3.4/site-packages/willow/image.py", line 62, in wrapper return operation(image, _args, *_kwargs) File "/Users/wayne/workspace/cms/venv/lib/python3.4/site-packages/willow/plugins/pillow.py", line 112, in auto_orient for transpose in ORIENTATION_TO_TRANSPOSE[orientation]: KeyError: 0

img_20160602_013511