Skip to content

Conversation

@fkleon
Copy link
Contributor

@fkleon fkleon commented Apr 20, 2025

I've come across multiple applications that fail to encode the EXIF UserComment field correctly (i.e. omitting the 8 byte ID code completely). In that case, ExifTool decodes the data correctly (with a warning), but imagemeta does not return any data for the field.

This seems to especially affect Python applications making use of Pillow which relies on applications implementing their own encoding for this field. One could argue that the applications are at fault here, but given "When in doubt, Exiftool is right".. here we go.

The included sample file was generated with the following script which is exactly how affected applications are setting the UserComment field:

# /// script
# requires-python = ">=3.12"
# dependencies = [
#     "pillow~=11.2.1",
# ]
# ///
from PIL import Image

def main() -> None:
    im = Image.new("1", (1, 1))
    exif = im.getexif()
    exif[0x9286] = "UserComment"
    im.save("invalid-encoding-usercomment.jpg", exif=exif)


if __name__ == "__main__":
    main()

However, emit a warning in this case.
@codecov-commenter
Copy link

codecov-commenter commented Apr 20, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 77.91%. Comparing base (ee0de9b) to head (3ea2b56).
Report is 2 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main      #45   +/-   ##
=======================================
  Coverage   77.90%   77.91%           
=======================================
  Files          14       14           
  Lines        1711     1716    +5     
=======================================
+ Hits         1333     1337    +4     
- Misses        290      291    +1     
  Partials       88       88           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@bep bep merged commit 741c616 into bep:main Apr 20, 2025
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants