-
-
Notifications
You must be signed in to change notification settings - Fork 2.4k
exif_transpose errors out on some images #3973
Copy link
Copy link
Closed
Labels
Description
What did you do?
Used new exif_transpose method.
What did you expect to happen?
I expected a transposed image to be returned, without error.
What actually happened?
An error was raised.
/Users/okor/thumbor/lib/python2.7/site-packages/PIL/TiffImagePlugin.py:612: UserWarning: Metadata Warning, tag 282 had too many entries: 2, expected 1
tag, len(values)))
/Users/okor/thumbor/lib/python2.7/site-packages/PIL/TiffImagePlugin.py:612: UserWarning: Metadata Warning, tag 283 had too many entries: 2, expected 1
tag, len(values)))
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Users/okor/thumbor/lib/python2.7/site-packages/PIL/ImageOps.py", line 549, in exif_transpose
transposed_image.info["exif"] = exif.tobytes()
File "/Users/okor/thumbor/lib/python2.7/site-packages/PIL/Image.py", line 3087, in tobytes
return b"Exif\x00\x00"+head+ifd.tobytes(offset)
File "/Users/okor/thumbor/lib/python2.7/site-packages/PIL/TiffImagePlugin.py", line 818, in tobytes
count = len(data)
TypeError: object of type 'int' has no len()
Note that this error is not raised for all images. Only some. I'm not sure how the EXIF data differs.
What are your OS, Python and Pillow versions?
- OS: macOS Mojave 10.14.5
- Python: 2.7.16
- Pillow: 6.0.0
from PIL import Image, ImageOps
im = Image.open('10_years_of_Wikipedia_by_Guillaume_Paumier.jpg')
im = ImageOps.exif_transpose(im)10_years_of_Wikipedia_by_Guillaume_Paumier.jpg.zip
This error was encountered when attempting to replace piexif exif functionality with new Pillow functionality. The PR and conversation is here thumbor/thumbor#1209
Reactions are currently unavailable