Pillow
Pillow copied to clipboard
Do not save XMP from JPEG info
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.