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. I reported a very similar problem previously (#7495) and as before, the image contains a multi-segment EXIF according to ExifTool. ExifTool reads it OK and shows me the comment with the multi-segment warning. I can see the User Comment on the console and it's large but looks intact.
What did you expect to happen?
User comment to be 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:890: 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.3.0
--------------------------------------------------------------------
Pillow 10.3.0
Python 3.11.9 (main, Apr 6 2024, 17:59:24) [GCC 11.4.0]
--------------------------------------------------------------------
Python executable is /home/diffusion_tools/venv/bin/python3
Environment Python files loaded from /home/diffusion_tools/venv
System Python files loaded from /usr
--------------------------------------------------------------------
Python Pillow modules loaded from /home/diffusion_tools/venv/lib/python3.11/site-packages/PIL
Binary Pillow modules loaded from /home/diffusion_tools/venv/lib/python3.11/site-packages/PIL
--------------------------------------------------------------------
--- PIL CORE support ok, compiled for 10.3.0
--- TKINTER support ok, loaded 8.6
--- FREETYPE2 support ok, loaded 2.13.2
--- LITTLECMS2 support ok, loaded 2.16
--- WEBP support ok, loaded 1.3.2
--- WEBP Transparency support ok
--- WEBPMUX support ok
--- WEBP Animation support ok
--- JPEG support ok, compiled for libjpeg-turbo 3.0.2
--- OPENJPEG (JPEG2000) support ok, loaded 2.5.2
--- ZLIB (PNG/ZIP) support ok, loaded 1.2.11
--- LIBTIFF support ok, loaded 4.6.0
--- RAQM (Bidirectional Text) support ok, loaded 0.10.1, fribidi 1.0.8, harfbuzz 8.4.0
*** LIBIMAGEQUANT (Quantization method) support not installed
--- XCB (X protocol) support ok
--------------------------------------------------------------------
with Image.open("0a09dcf7.jpeg") as i:
x = i.getexif().get_ifd(ExifTags.IFD.Exif)
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. I reported a very similar problem previously (#7495) and as before, the image contains a multi-segment EXIF according to ExifTool. ExifTool reads it OK and shows me the comment with the multi-segment warning. I can see the User Comment on the console and it's large but looks intact.
What did you expect to happen?
User comment to be 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:890: UserWarning: Truncated File Read
What are your OS, Python and Pillow versions?