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

The image resulting from image_resize() has width and height inverted (EXIF orientation problem) #2445

Open
gfauredev opened this issue Feb 29, 2024 · 2 comments
Labels
bug done in pr Already done in a PR

Comments

@gfauredev
Copy link

gfauredev commented Feb 29, 2024

Bug Report

Environment

Zola version: 0.18.0

Expected Behavior

The dimensions in image_resize() function call should always be the dimensions of the resulting image.

If this is not possible, the function should prevent confusion, for example by warning the user, and provide a way to deal with that in templates, for example by providing an orientation field in get_image_metadata() output.

Current Behavior

The current function seem to apply before EXIF reorientation. For example here's my image not processed by Zola

❯ identify static/photos/testExif.jpeg
static/photos/testExif.jpeg JPEG 4032x3024 4032x3024+0+0 8-bit sRGB 2.4495MiB 0.000u 0:00.000

❯ identify -format '%[orientation]' static/photos/testExif.jpeg
RightTop%

and after zola build with resize_image(src=/photos/testExif.jpeg, width=2000, height=1000)

❯ identify static/processed_images/testExif.jpg
static/processed_images/testExif.357e1078f1bc4b6c.jpg JPEG 1000x2000 1000x2000+0+0 8-bit sRGB 259274B 0.000u 0:00.000

❯ identify -format '%[orientation]' static/processed_images/testExif.357e1078f1bc4b6c.jpg
Undefined% 

Which is very confusing because the resulting image doesn’t have the width and height I set in the resize function.

Step to reproduce

Try to resize_image() an image with EXIF orientation not null, the resize don’t apply where you expect.

@amtanq
Copy link

amtanq commented Mar 31, 2024

Raised a fix: #2468

Let me know if you have any remarks

@gfauredev
Copy link
Author

Just tested it and it looks good, thanks for your fix 👍

@Keats Keats added the done in pr Already done in a PR label Apr 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug done in pr Already done in a PR
Projects
None yet
Development

No branches or pull requests

3 participants