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

Metadata like exif and xmp is lost on save #39

Open
Dobatymo opened this issue May 29, 2023 · 1 comment
Open

Metadata like exif and xmp is lost on save #39

Dobatymo opened this issue May 29, 2023 · 1 comment

Comments

@Dobatymo
Copy link

Dobatymo commented May 29, 2023

Not sure why though. According to libjpeg-turbo TJXOPT_COPYNONE needs to be set to not copy it.

Test using the test file in the test folder.

from jpegtran import JPEGImage
img = JPEGImage("test/test.jpg")
img.save("test/test-save.jpg")
img.rotate(90).save("test/test-rotate.jpg")
img.crop(0, 0, 64, 64).save("test/test-crop.jpg")

test-save.jpg keeps the metadata, the other two not.

@mixmastamyk
Copy link

mixmastamyk commented Oct 29, 2024

I'm using it for this:

corrected = photo.exif_autotransform()

This used to preserve and update the Exif.

jpegtran -outfile foo2.jpeg -rotate 90 foo.jpeg loses the Exif as well.

jpegtran -rotate 90 -copy all -outfile foo2.jpeg foo.jpeg copies it, but the orientation needs updating.

Looking thru the code, not sure how it ever worked. There doesn't seem to be any affordance for the copy parameter, and it isn't a member of the transform options. Maybe the default in the C code changed at some point, but doesn't look recently updated either.

I had to change my code to a double subprocess.call of jpegtran and exiftool. :-(

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

No branches or pull requests

2 participants