-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Exception while reading EXIF data from JPEG #3337
Comments
I think the reason for that is slightly different header which is not processed by Pillow correctly. Here is the TIFF header ("that follows
and here the header of the file which causes troubles:
The difference is two extra bytes (132 132) that follow header in latter case. The offset in latter case (012) takes into account those two bytes (normal offset is 010), but apparently Pillow does not take into account that offset when parsing remaining TIFF structure. I am not sure what is the best way to fix this, I looked at
Let me know if you want me to open PR with this fix. |
I have created PR #3584 to resolve this. As you are the only one with the actual image, it would be good if you could test that branch against your image, on Windows and on Linux. |
Thanks for the fix! I have built |
Good to hear! To test on Windows, you can find and edit JpegImagePlugin.py (eg. |
With that small patch it works fine on windows too (applied on top of Pillow 5.4.1). |
Excellent. Thanks very much |
There is one weird image that causes
Image.open()
to generate exception on 32-bit Python on windows. It looks like pillow thinks that EXIF data is corrupted though other applications can read exif data normally.What did you do?
Call
PIL.Image.open("file.jpg")
What did you expect to happen?
Call to return normally without exception or complaints
What actually happened?
Pillow generates multiple UserWarning messages about possibly corrupt EXIF, and it also raises exception on 32-bit Python build.
What versions of Pillow and Python are you using?
Pillow 5.2.0, Python 3.6
Here is what happens on 32-bit Windows build:
On 64-bit Linux build I see the same warnings, but exception is not raised:
I am attaching image file but that file has actual image section stripped (the whole 0xFFDA section removed, but rest of the content is intact) as this is not my photo and I don't want to upload someone else's pictures here. With this stripped image I can still see warnings and exception on 32-bit build:
The text was updated successfully, but these errors were encountered: