Skip to content

Multi-segment Exif fails to read #7495

@worthlesscog

Description

@worthlesscog

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)

03d2695a.jpeg.zip

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions