You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I opened/created a new image with XMP and Exif data. I saved the image using save() without passing the XMP/Exif data.
What did you expect to happen?
In Pillow 10.x, the saved image would not contain any metadata (xmp, exif, ...) unless explicitly passed to save().
What actually happened?
In Pillow 11.0.0, the save image contains XMP metadata although I did not pass it to save().
#8286 introduced writing XMP data and its behavior changed with earlier versions and is now inconsistent wrt to how writing exif data is handled. I'd expect either all metadata to be written by default or none.
I believe how the default value of xmp/exif are defined makes the difference:
fromPILimportImageim=Image.new("RGB", (128, 128))
im.info["xmp"] =b"some data"im.info["exif"] =b"some more data"im.save("img_with_metadata.jpg")
inter=Image.open("img_with_metadata.jpg")
ifinter.info.get("xmp") ==b"some data":
print("XMP data is present")
else:
print("XMP data is not present")
ifinter.info.get("exif") ==b"some more data":
print("EXIF data is present")
else:
print("EXIF data is not present")
>>> XMP data is present
>>> EXIF data is not present
The text was updated successfully, but these errors were encountered:
maltelorbach
changed the title
Writing of XMP and EXIF is now inconsistent due to #8286
Writing of XMP and EXIF is inconsistent in 11.0.0 due to #8286
Oct 17, 2024
What did you do?
I opened/created a new image with XMP and Exif data. I saved the image using
save()
without passing the XMP/Exif data.What did you expect to happen?
In Pillow 10.x, the saved image would not contain any metadata (xmp, exif, ...) unless explicitly passed to
save()
.What actually happened?
In Pillow 11.0.0, the save image contains XMP metadata although I did not pass it to
save()
.#8286 introduced writing XMP data and its behavior changed with earlier versions and is now inconsistent wrt to how writing exif data is handled. I'd expect either all metadata to be written by default or none.
I believe how the default value of xmp/exif are defined makes the difference:
https://github.com/radarhere/Pillow/blob/6e2ebaae2d50302b58ab046257df492493e5e86e/src/PIL/JpegImagePlugin.py#L754
https://github.com/radarhere/Pillow/blob/6e2ebaae2d50302b58ab046257df492493e5e86e/src/PIL/JpegImagePlugin.py#L794
What are your OS, Python and Pillow versions?
Example
Running above code with Pillow 10.4.0:
With Pillow 11.0.0:
The text was updated successfully, but these errors were encountered: