Skip to content

Conversation

@patrickfournier
Copy link
Collaborator

This pull request improves how EXIF tags are handled when processing images, especially regarding image dimensions, and enhances the related test coverage. The most important changes can be grouped as follows:

EXIF Tag Copying and Image Dimension Handling:

  • The plugin now updates the ExifImageWidth and ExifImageHeight tags to match the dimensions of the transformed image when copying EXIF tags. This ensures that metadata accurately reflects the new image size after processing.
  • The EXIF tag copying logic updates dimension tags only if they existed in the source image, preventing the addition of these tags to images that originally lacked them.

Testing Enhancements:

  • Added new tests to verify that dimension tags are correctly copied and updated when present, and that they are not added to images that lack them.

Process and Logging Improvements:

  • Changed the EXIF tool subprocess so that its stderr is redirected to stdout, and improved logging by outputting the exact exiftool command used for debugging purposes.

Documentation:

  • Updated the documentation to explain the new behavior regarding EXIF dimension tags.

Minor Edits:

  • Minor formatting improvements in the README for better readability.

If a processed image has the ExifImageWidth or ExifImageHeight tags and the IMAGE_PROCESS_COPY_EXIF_TAGS setting is True, update the tags to the same value as ImageWidth or ImageHeight, respectively.

Add tests to verify that:
 - an image without ExifImageWidth or ExifImageHeight is left untouched
 - in an image with ExifImageWidth or ExifImageHeight, their values
   are the same as ImageWidth or ImageHeight.
@patrickfournier patrickfournier changed the title Update exif dimensions Improve EXIF dimension tags handling Nov 2, 2025
Copy link
Contributor

@justinmayer justinmayer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems sensible to me. Any thoughts, @minchinweb?

@justinmayer justinmayer changed the title Improve EXIF dimension tags handling feat: Improve EXIF dimension tags handling Nov 2, 2025
@minchinweb
Copy link
Member

I'm just able to do a "desktop" (ok, phone) review at the moment, but it looks good. Thanks for the PR, and thanks for including tests!

I was vaguely aware that Exif dimensions could mis-match the "physical" dimensions, as it came up on Immich's list of "Cursed Knowledge", bit hadn't drawn the connection it could affect us here.

(For future reference,) Is there a reason not to add these dimensions to images that don't already have them?

Also, should add a note to our list of "known issues" that Exif and "physical" dimensions will drift of ExifTool isn't installed?

@patrickfournier
Copy link
Collaborator Author

I do not add the EXIF dimension tags because I don't want to "pollute" the image with tags that were not there originally.

If ExifTool is not installed, the tags (including the EXIF dimension tags) will not be copied from the original image, so there is no possibility for them to drift from the correct value.

@minchinweb
Copy link
Member

Everything looks good to me! @justinmayer will you merge this?

@justinmayer
Copy link
Contributor

Yes, indeed, I’d be happy to. Thank you for taking a look — I appreciate the extra set of eyes.

@patrickfournier: Many thanks for your work on this! ✨

@justinmayer justinmayer merged commit c827fda into pelican-plugins:main Nov 3, 2025
7 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