-
-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Closed
Description
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?
- OS: Linux pop-os 6.2.6-76060206-generic (Ubuntu compatible with 22 I think)
- Python: 3.11
- Pillow: 10.1.0
with Image.open("03d2695a.jpeg") as i:
x = i.getexif().get_ifd(ExifTags.IFD.Exif)