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

Use exif metedata to rotate images #311

Closed
yeniklas opened this issue Apr 3, 2020 · 9 comments
Closed

Use exif metedata to rotate images #311

yeniklas opened this issue Apr 3, 2020 · 9 comments
Labels

Comments

@yeniklas
Copy link

yeniklas commented Apr 3, 2020

I've noticed that many of my photos are turned the wrong way around(I use szurubooru for managing photos).

Photos taken in portrait will be turned sideways, however if I click the "download" button the browser turns the image the right way.

You think this is something that is fixable? I'm not sure if this is too far from the intended use case but I'm throwing out the question at least.

@sgsunder
Copy link
Collaborator

sgsunder commented Apr 4, 2020

Seems related to this discussion: https://stackoverflow.com/a/42428659/13027787

Makes it sound like primarily a browser-based issue. We might be able to hardcode the rotation in the image once it's uploaded, but I'm not sure if that's a good idea (might be a lossy transform)

@yeniklas
Copy link
Author

yeniklas commented Apr 4, 2020

I see, I was not aware of this browser problem. I think if we need to do conversions in Szurubooru itself it won't be worth it. In that case it's probably better to just preprocess the images before upload.

Or maybe it could be an option during upload to rotate the images based on exif.

@TangentFoxy
Copy link

an option during upload to rotate the images based on exif

This gets my vote! Would be nice.

@noirscape
Copy link
Contributor

If that's going to be the way, I would really prefer for that to be a configuration option. Right now, one of the reasons I like szurubooru is specifically because it's not manipulating or downscaling the images outside of generating the thumbnail.

If the source images are going to be modified, that would be a major negative for my usecase of szurubooru.

@yeniklas
Copy link
Author

yeniklas commented Apr 8, 2020

I agree, it should be an option during upload but should not change current behaviour.

@noirscape
Copy link
Contributor

noirscape commented Apr 8, 2020

during upload

I suppose I wasn't clear, I would like this to be an administrative permission (so in the config.yaml), if this were ever to be implemented.

@yeniklas
Copy link
Author

yeniklas commented Apr 8, 2020

I see. Yeah I think it would make sense to allow utilizing this feature through permissions in a similar way as with the youtube-dl feature.

@sgsunder
Copy link
Collaborator

sgsunder commented Apr 8, 2020

I would not do any messing around with the image on server-side at all (even as an option).

The CSS property image-orientation: from-image would do exactly what this issue is asking for, however browser support is not really there yet (basically only Firefox for now, however Chrome Canary also has it implemented so it's likely to come to mainline Chrome very soon.)

I will author and test (in Firefox) a commit with this CSS property soon.

We could write some client-side JS to do it manually and get more browsers to support it, but I'm not sure it's worth the effort - other browsers will eventually support the CSS option as well. If someone really wants a JS implementation, I'll be willing to review a PR.

See https://stackoverflow.com/a/36593389/13027787 for more details

@sgsunder sgsunder added the bug label Apr 8, 2020
sgsunder added a commit that referenced this issue Apr 8, 2020
this uses the optionally implemented "image-orientation: from-image"
CSS property, and will not work on every browser.

see #311
@thegreatestminer
Copy link

image-orientation is now widely supported by Edge, Firefox, Chrome, and Opera.

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

No branches or pull requests

5 participants