You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Writing code to read ai generated images and tried to get User Comment field from EXIF data contained in an image opened with Image.open. The jpeg image is as far as I can tell not corrupt. ExifTool reads it OK and shows me the comment with a minor warning that "File contains multi-segment EXIF." I can see the User Comment listed in the console with ExifTool. It's large, but looks OK.
What did you expect to happen?
User Comment field to be read and returned.
What actually happened?
Using image.getexif().get_ifd(ExifTags.IFD.Exif) returns an empty dict along with this warning on the console-
python3.11/site-packages/PIL/TiffImagePlugin.py:868: UserWarning: Truncated File Read
What are your OS, Python and Pillow versions?
OS: Linux pop-os 6.2.6-76060206-generic (Ubuntu compatible with 22 I think)
Exif metadata are restricted in size to 64 kB in JPEG images because according to the specification this information must be contained within a single JPEG APP1 segment.
So this image is actually incorrect. However, I've created PR #7496 to make Pillow more flexible and combine the EXIF markers.
Oh, that was quick, thank you. I didn't know it was outside the spec. It wasn't my image so I have no idea which tool produced it.
I'd done some searches before and saw a post by Phil on the ExifTool forum saying multi-segment Exif wasn't well supported but didn't actually say it was incorrect. ExifTool lists it as a minor warning.
What did you do?
Writing code to read ai generated images and tried to get User Comment field from EXIF data contained in an image opened with Image.open. The jpeg image is as far as I can tell not corrupt. ExifTool reads it OK and shows me the comment with a minor warning that "File contains multi-segment EXIF." I can see the User Comment listed in the console with ExifTool. It's large, but looks OK.
What did you expect to happen?
User Comment field to be read and returned.
What actually happened?
Using image.getexif().get_ifd(ExifTags.IFD.Exif) returns an empty dict along with this warning on the console-
python3.11/site-packages/PIL/TiffImagePlugin.py:868: UserWarning: Truncated File Read
What are your OS, Python and Pillow versions?
03d2695a.jpeg.zip
The text was updated successfully, but these errors were encountered: