-
Notifications
You must be signed in to change notification settings - Fork 45
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
EXIF rotation information should be addressed #395
Comments
This is a very good point. I am using the Maybe it is worth considering to rotate the images manually when loading. |
In zune-imageprocs there is an auto orient function but I'm not so sure if you can use it with |
I'm working on Exif orientation support in I should get it working in the next few days, but there's no telling how long will it take to get the changes reviewed and released as part of |
I got it working in |
Wow! Firstly, wondermagick looks amazing! Super cool you are adding this to image. Maybe all I have to do is wait then? Do you have experience with the time needed in image to merge PRs like yours? If that is a long time away, I might copy and paste some of your solution first. Cheers! |
My PRs for Exif support have been merged into You can now make use of them provided you're OK with depending on a git version of |
That is amazing news, thanks! If I recall correctly I am using some other crates that need to match the |
|
You are amazing, and thank you for following up now that is released! I have to check if I can replace exif everywhere as I read maybe exif from more formats than |
I see you're using kamadak-exif. You can keep using it for extracting Exif metadata and then use use image::{metadata::Orientation, DynamicImage, ImageReader, ImageDecoder};
use exif::{In, Tag}; // from `kamadak_exif`
let mut decoder = ImageReader::open("file.jpg")?.into_decoder()?;
let raw_exif = decoder.exif_metadata();
let mut image = DynamicImage::from_decoder(decoder)?;
// Parse Exif chunk (if present) and apply the orientation
if let Ok(Some(raw_exif)) = raw_exif {
let reader = exif::Reader::new();
let exif = reader.read_raw(raw_exif)?;
if let Some(orientation) = exif.get_field(Tag::Orientation, In::PRIMARY) {
if let Some(value) = orientation.value.get_uint(0) {
if let Some(orientation) = Orientation::from_exif(value as u8) {
image.apply_orientation(orientation);
}
}
}
} |
Wow, there is some other good stuff in the release notes. I can probably get rid of other external libraries such as fast blur. Exif support looks good as well! |
We couldn't add this in a point release because that would be a breaking change: if someone was already read Exif and rotate accordingly, auto-rotation on load would break their code.
You still need kamadak-exif to parse the extracted Exif chunk if you need things other than the orientation. But it's a robust library in 100% safe code, so I really don't see a good reason to remove it. |
Thank you for taking the time to respond so quickly! That makes a lot of sense. I've got the rotation already working, and I actually like the flexibility with manually rotating. For JPG I am still using turbojpeg, so I have to manually rotate anyways. Maybe instead of doing this in all loaders I'll try to do this as a post process or generic step after loading is done. |
Describe the bug
Some photos (especially from digital cameras) bake EXIF rotation information instead of making the aspect ratio actually vertical. Most image viewers read the information and rotate the view. It seems like Oculante doesn't do this and many of my photos are rotated.
Desktop (please complete the following information):
The text was updated successfully, but these errors were encountered: