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

Always rotate images to ensure correct orientation #158

Merged
merged 3 commits into from
Jan 15, 2024

Conversation

nosecreek
Copy link
Contributor

#132 solved the issue of some images not being rotated properly due to not respecting EXIF data. However, some images are still not being rotated correctly, especially landscape images that may have been shot upside down (rotated 180 degrees). For example, on an iPhone it is easy to shoot landscape images with either edge of the phone "up" - half of these photos will end up rotated incorrectly. This pull request fixes the issue by always calling .rotate() to ensure images have the correct orientation.

@nathan-bottomley
Copy link

I’m still encountering this problem quite often, in exactly the circumstances nosecreek describes above

@GHF
Copy link
Contributor

GHF commented Sep 15, 2023

I agree with this approach of always calling sharp rotate, because EXIF orientations 2–4 also require processing, even though the result would have the same dimensions as the original. The documentation of rotate says

If no angle is provided, it is determined from the EXIF data. Mirroring is supported and may infer the use of a flip operation.

I'm not sure how to test for this with a dry run, however.

@zachleat
Copy link
Member

I’ll merge this one for v3.1.9 but as an opt-in feature. I don’t think I want to apply this by default to every image before we prove that the performance cost is negligible.

@zachleat zachleat added this to the Eleventy Image v3.1.9 milestone Jan 15, 2024
@zachleat zachleat merged commit baea57d into 11ty:main Jan 15, 2024
@zachleat zachleat added the enhancement New feature or request label Jan 15, 2024
@zachleat
Copy link
Member

Use the fixOrientation: true option to opt-in to this feature!

zachleat added a commit to 11ty/11ty-website that referenced this pull request Jan 15, 2024
zachleat added a commit that referenced this pull request Jan 15, 2024
@zachleat
Copy link
Member

zachleat commented Feb 2, 2024

Changed to v3.2.0

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

Successfully merging this pull request may close these issues.

4 participants