Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improved consistency of XMP handling #8069

Merged
merged 4 commits into from
Jun 19, 2024
Merged

Conversation

radarhere
Copy link
Member

#5076 (comment) is a user who would like to retrieve XMP strings from images. This can be done, but inconsistently between formats.

This PR updates JPEG, TIFF and PNG to create im.info["xmp"] like WEBP does.

Then, given that common location of XMP data, it makes sense to tidy up the code by adding getxmp() to the Image class, rather than duplicating it for each of supported formats. getxmp() will return an empty dictionary for other formats.

@hugovk hugovk merged commit 96b1cab into python-pillow:main Jun 19, 2024
56 checks passed
@radarhere radarhere deleted the xmp branch June 19, 2024 21:37
@bigcat88
Copy link
Contributor

Since this change removed the _getxmp function - which I used in pillow_heif, could you at least add parsing for the NULL terminating byte in xmp? @radarhere

Info is here:

bigcat88/pillow_heif#69
AOMediaCodec/libavif#1333 - topic is big, but most important are last messages

Because now I need to either remove the leading byte, which will lead to the fact that if the image is opened and saved, the xmp will differ in a result by that one byte.

That will allows me to just remove getxmp from pillow_heif, otherwise I will need to copy old _getxmp code and use it..

@radarhere
Copy link
Member Author

Ah, I had presumed I was just removing an unused internal method.

I've created #8171. Let us know if you have any feedback.

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.

None yet

3 participants