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

getexif() returns incomplete exif data since 8.2.0 #5894

Closed
Starcross opened this issue Dec 17, 2021 · 2 comments
Closed

getexif() returns incomplete exif data since 8.2.0 #5894

Starcross opened this issue Dec 17, 2021 · 2 comments
Labels

Comments

@Starcross
Copy link

Calling getexif() on an image instance prior to 8.2.0 used to return more information, for example shutter speed and aperture for images with this data present.

Calling the protected _getexif() continues to provide the full data set.

See also this discussion on stack overflow

@radarhere radarhere added the Exif label Dec 17, 2021
@radarhere
Copy link
Member

radarhere commented Dec 17, 2021

Hi. #4947 would be responsible for this.

The shutter speed and aperture is contained within the EXIF IFD - ShutterSpeedValue and ApertureValue in https://www.awaresystems.be/imaging/tiff/tifftags/privateifd/exif.html

Prior to #4947, we merged the EXIF IFD into the rest of the top level tags. This was not ideal however, as this meant that you couldn't tell which tags had been part of the EXIF IFD, and which tags had been already at the top level. So #4947 stopped this merging.

Instead, you can get the EXIF IFD using get_ifd().

from PIL import Image
with Image.open("Tests/images/flower.jpg") as im:
    exif = im.getexif()
exif_ifd = exif.get_ifd(0x8769)
print("ShutterSpeedValue", exif_ifd[0x9201])
print("ApertureValue", exif_ifd[0x9202])

I've also posted an answer to the StackOverflow question.

@Starcross
Copy link
Author

Great, thanks for the clarification

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants