-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
Add XMP writing #8283
Comments
a little thoughts:
|
From my reading of #8269 (reply in thread), you're requesting this for both JPEG and MPO? |
It's certainly easier to focus on JPEG first, but I wouldn't mind if MPO is also covered. Especially since this would enable creating UltraHDR JPEGs as well. but I suspect this to be a minor use case currently. |
Great, thanks! |
The PR will actually allow XMP data to be written to both JPEG and MPO images. from PIL import Image
for ext in ('.jpg', '.mpo'):
with Image.open("Tests/images/hopper.png") as im:
im.save('out'+ext, xmp=b"XMP test")
with Image.open('out'+ext) as reloaded:
assert reloaded.info["xmp"] == b"XMP test" |
@radarhere: Yes thanks! I could already confirm it. But I wasn't able to add a valid XMP entry to the second image of an MPO. But haven't checked / investigated for a few weeks. |
I've pushed a commit to the PR so that it uses the image's 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]) |
This is a feature request:
As a followup of this discussion it might be possible to add a simple XMP write support using the provided infrastructure (that is by passing image.encoderinfo["extra"]). This approach doesn't account for large XMP Data (>64Kb), but would be an improvement.
For an discussion on XMP, especially large XMP fields, see #5076, there are also sample images linked.
To keep the interface simple, it should only accept
str
in the first iteration, later on some XML structure, requirements for adict
interface would need full support for the XML data model like XML namespace support and lists of elements with the same name.See also #8069
The text was updated successfully, but these errors were encountered: