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

Do not save XMP from JPEG info #8483

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open

Conversation

radarhere
Copy link
Member

@radarhere radarhere commented Oct 18, 2024

Resolves #8479

Typically, XMP data is only saved to an image through an argument when saving, such as im.save("out.jpg", xmp=b"test").

#8286 included a commit to allow XMP data to be specified for the second frame of an MPO image when saving by using the info dictionary.

from PIL import Image

im = Image.open("Tests/images/hopper.png")
second_im = Image.new("RGB", (128, 128))
second_im.info["xmp"] = b"Second frame"
im.save("out.mpo", save_all=True, append_images=[second_im])

However, #8479 had pointed out that this means XMP info is now saved by default from images, and suggests that this may not be ideal. It's also not what WebPImagePlugin does.

So this PR stops XMP saving from the info dictionary.

However, to try and keep the ability to set XMP data for a second frame when saving, I suggest instead using encoderinfo.

from PIL import Image

im = Image.open("Tests/images/hopper.png")
second_im = Image.new("RGB", (128, 128))
second_im.encoderinfo = {"xmp": b"Second frame"}
im.save("out.mpo", save_all=True, append_images=[second_im])

That would provide a generic way to set additional options when saving subsequent frames.

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.

Writing of XMP and EXIF is inconsistent in 11.0.0 due to #8286
1 participant