Skip to content

Image.getexif() errors on n04532106_1553.JPEG from ImageNet #8957

Open
@iperminov-mythic

Description

@iperminov-mythic

This image file seems to have invalid utf-8 in xmp tags and getexif errors with

Traceback (most recent call last):
  File "/.../lib/python3.10/site-packages/PIL/Image.py", line 1542, in getexif
    xmp_tags = xmp_tags.decode("utf-8")
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xa8 in position 4312: invalid start byte

This is not technically a bug, but it may be better to print a warning instead of throwing an error. ImageNet is a popular dataset and this issue is going to be painful for its users.

The issue only happens with Pillow 11.2.1, because the previous versions do not have this UTF decoding step.
7d50816#diff-4805c79264fea07df59058db82ed74bb2f5c5023e212ac678536a534c56e5be2R1524

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions