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

EXIF tag InteropVersion has wrong type #5553

Closed
AdrienF opened this issue Jun 23, 2021 · 3 comments · Fixed by #5554
Closed

EXIF tag InteropVersion has wrong type #5553

AdrienF opened this issue Jun 23, 2021 · 3 comments · Fixed by #5554
Labels

Comments

@AdrienF
Copy link

AdrienF commented Jun 23, 2021

What did you do?

Open an image with Pillow and save it with its exif data.

What did you expect to happen?

The content of the exif field InteropVersion must be the same in both files.

What actually happened?

The type of InteropVersion field value is set to TiffTags.BYTE (1) by Pillow where it should be of type TiffTags.UNDEFINED (7) to conform to standard. Some software might rely on that field to assess the validity of the file.

What are your OS, Python and Pillow versions?

from PIL import Image
#open a jpeg image
im = Image.open("original.jpg")
# save it with original parameters, but it doesn't change the problem to use default values
im.save("copy.jpg", exif=im.getexif(), quality=95, progressive=True, subsampling="4:4:4")

Original image:
pixelated

Result image:
original_copy

Extract of the EXIF data from the original file (using exiftool -D -s original.jpg):

40962 ExifImageWidth                  : 1920
40963 ExifImageHeight                 : 692
    1 InteropIndex                    : R98 - DCF basic file (sRGB)
    2 InteropVersion                  : 0100

In the saved file (using exiftool -D -s copy.jpg):

40962 ExifImageWidth                  : 1920
40963 ExifImageHeight                 : 692
    1 InteropIndex                    : R98 - DCF basic file (sRGB)
    2 InteropVersion                  : 48 49 48 48
@radarhere radarhere added the Exif label Jun 23, 2021
@AdrienF
Copy link
Author

AdrienF commented Jun 23, 2021

A workaround, from a user perspective, is to save file to a buffer, then seek and change the type of the IFD tag, and save the file.

@radarhere
Copy link
Member

I created #5554 to resolve this, by adding tag data for specific tag groups.

@AdrienF
Copy link
Author

AdrienF commented Jun 25, 2021

I tested the fix and it does the job.
Thanks for the quick dev time!

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 a pull request may close this issue.

2 participants