-
-
Notifications
You must be signed in to change notification settings - Fork 7.5k
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
images: Add AutoOrientation flag #8751
Conversation
Hi, I've faced a problem that one of the images loses EXIF orientation when resized by Hugo. After digging I found the #5181 issue I've tested my changes locally, and when I set the AutoOrientation to true my image keeps the original EXIF orientation as I expect. I don't know if it's a breaking change or not, so I've set the default AutoOrientation to false to keep the default Hugo behavior unchanged. But honestly, I'd expect that the default value for AutoOrientation will be true, so other people won't need to figure out why their images have wrong orientation. I'd love to hear a maintainer opinion on the default value AutoOrientation. And please let me know if I missed something. Thanks |
I will happy to merge this if you can do it without introducing a new big image library. |
We should probably look a this in relation to #8586 |
328070c
to
738c0c7
Compare
I considered two approaches: 2) - read orientation tag and rotate image per tag value in hugo image processing pipeline It'll fix my use case: image shot on a phone and has Orientation = 6 = Rotate 90 CW. Bep, I'd love to know your thoughts before i continue working on a code. Thanks Note: i'm working on the top of Bep changes from master...bep:feat/replace-exif-lib so review looks messy right now. (it mixes both Bep and my changes) |
Oh, i found another lib imageorient. It's a small lib that only handles image orientation and nothing more. Bep, will you merge changes if I use the small library imageorient instead of using big library imaging and instead of writing custom rotation implementation? The changes will be similar to 2d13df8 |
738c0c7
to
2c6f1f3
Compare
I've used imageorient lib that only handles image orientation and nothing more. Tested locally - it works. |
When AutoOrientation flag set to true, image will be transformed after decoding according to the EXIF orientation tag (if present). This will help with cases when EXIF orientation tag is unexpectidly overriden to default value. Fixes gohugoio#5181
2c6f1f3
to
79373e2
Compare
This PR has been automatically marked as stale because it has not had recent activity. The resources of the Hugo team are limited, and so we are asking for your help. |
Bep, you've asked to not use big library, so I've added small one: imageorient that only handles image orientation and nothing more. It's the lib of the same author that wrote gift image processing library that's already used in Hugo. @bep Can you please advice if this changes are good to be merged? If they do, I'll rebase the changes and re-check code. Thanks |
@jmooring, is there a chance you can advice on the fate of this PR? |
I'm not adding more dependencies to get this done (we do not want to read the Exif info twice, for once). |
This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
When AutoOrientation flag set to true, image will be transformed
after decoding according to the EXIF orientation tag (if present).
This will help with cases when EXIF orientation tag is unexpectidly
overriden to default value.
Fixes #5181