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

Width and height of image are transposed when EXIF contains rotation metadata #61

Open
Gilthans opened this issue Jun 21, 2023 · 0 comments

Comments

@Gilthans
Copy link

Gilthans commented Jun 21, 2023

EXIF supports 'Orientation' parameter, which may instruct the image to be opened after rotating by 90 degrees. This is respected by all software I have tested, but unfortunately not by imagesize, causing incorrect results.

Sample image:
example-exif
Same image with orientation EXIF set to rotate 90 degrees CW:
example-exif-rotated

However, when I run the following code:

print(imagesize.get('example-exif.jpg')) # This prints (300, 100)
print(imagesize.get('example-exif-rotated.jpg')) # This prints (300, 100)

# Note that numpy image dimensions are (height, width, colors)
print(imageio.imread('example-exif-rotated.jpg').shape) # This prints (100, 300, 3)
print(imageio.imread('example-exif-rotated.jpg').shape) # This prints (300, 100, 3)
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

1 participant