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

Thumbsup added unecessary rotation? #317

Closed
patniemeyer opened this issue Oct 30, 2022 · 7 comments
Closed

Thumbsup added unecessary rotation? #317

patniemeyer opened this issue Oct 30, 2022 · 7 comments
Labels
bug Existing bug

Comments

@patniemeyer
Copy link

I'm noticing that some jpeg files are having an unexpected rotation applied. I can see this in the log trace where gm is being called with a 90 degree rotation:

gm "convert" "-quality" "90" "photos/IMG_1712.jpeg" "-rotate" "90" "-page" "+0+0" "-resize" "x1000>"

The original photo exif info is here (in this gist): https://gist.github.com/patniemeyer/efdc706a12b2671696d68392eb05898d

I had guessed that this had something to do with these files being transferred from iPhone and maybe converted from HEIF along the way. But why would Thumbsup be running gm with a rotation explicitly?

Thanks for you work... thumbsup is great.

@patniemeyer patniemeyer added the bug Existing bug label Oct 30, 2022
@rprieto
Copy link
Member

rprieto commented Oct 30, 2022

Hi! Thanks for reporting this.

Today, Thumbsup applies a rotation because it strips the EXIF data from the resized images. This is both for privacy reasons, and because not all bowsers used to render rotation properly.

In the EXIF info you posted, there is a 90CW rotation, so that's what being applied to compensate for the loss of metadata. Does the result not look like you expect?

There is a new feature about to land that allows you to preserve EXIF data, in which case it doesn't apply rotations.

@patniemeyer
Copy link
Author

Thanks. So, the image looks correct in the Finder and Preview (on Mac) and in fact I suspect that the image was rotated to this position using the rotate feature of the quick-view in Finder. However after gm generates the thumbnail it appears incorrect (with an extra clockwise 90degree rotation). What you are saying (about stripping the exif and baking in the rotation) makes sense... not sure what's up. I'll do some experiments and see if I can tell where things are going wrong.

@patniemeyer
Copy link
Author

patniemeyer commented Oct 30, 2022

Ok, I think the problem is that the exif information is not being stripped from the galleria media. I still see it (including the rotation) in the generated thumbnail image.

For reference I installed thumbsup via npm (per instructions) yesterday, grabbing the latest GraphicsMagick with brew. Maybe it no longer strips the exif? (I'll take a look).

EDIT: It looks like gm would need a --strip option in order to remove the exif data but I don't see this in the trace.

@patniemeyer
Copy link
Author

Here is an example photo that you can use to test: https://pat.net/misc/IMG_1712.jpeg . This photo (the person anyway, ignore the border) gets rendered to a thumbnail rotated an additional 90 degrees.

@tpimh
Copy link

tpimh commented Nov 10, 2022

@patniemeyer Thank you so much for your findings! Just faced a similar problem, and your posts saved me so much time investigating it. I resolved it by just adding "gm-args": "strip" to my config. I guess a command-line option --gm-args strip should work just as well, not tested it though.

@patniemeyer
Copy link
Author

Thanks, I was not aware of the --gm-args option. I had ended up writing a script to normalize all of my photo types and naming anyway so I just pre-rotated them there, but I may switch to your method.

@rprieto
Copy link
Member

rprieto commented Mar 22, 2023

Hi @patniemeyer and @tpimh.

Thanks again for finding this bug. Indeed, the latest version of GM no longer strips EXIF info when using auto-orient (which Thumbsup does). That was unexpected!

It’s now fixed in the latest version published on npm (2.17.1).

@rprieto rprieto closed this as completed Mar 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Existing bug
Projects
None yet
Development

No branches or pull requests

3 participants