Skip to content

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.

@hugovk hugovk merged commit f42d1c1 into python-pillow:main Dec 27, 2024
49 checks passed
@radarhere radarhere deleted the xmp branch December 27, 2024 19:52
radarhere added a commit to radarhere/Pillow that referenced this pull request Dec 28, 2024
@radarhere radarhere added the JPEG label Dec 28, 2024
radarhere added a commit to radarhere/Pillow that referenced this pull request Dec 28, 2024
radarhere added a commit to radarhere/Pillow that referenced this pull request Dec 28, 2024
radarhere added a commit to radarhere/Pillow that referenced this pull request Feb 27, 2025
eyedav pushed a commit to eyedav/Pillow that referenced this pull request Jul 19, 2025
eyedav pushed a commit to eyedav/Pillow that referenced this pull request Jul 19, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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

2 participants