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

Orientation field not found after load image and save #1371

Closed
fospring opened this issue Nov 18, 2020 · 2 comments
Closed

Orientation field not found after load image and save #1371

fospring opened this issue Nov 18, 2020 · 2 comments

Comments

@fospring
Copy link

This happens in open a image

Expected

Image's Orientation information can be reserved

Actual behaviour

What did happen
But image's Orientation information was discard, and image rotated 180 degrees.

Reproduction steps

extern crate image;
use image::GenericImageView;
fn main() {
    let img = image::open("/tmp/images/origin176.jpeg").unwrap();
    img.save("/tmp/images/176.jpeg").unwrap();
}

the origin image info:

➜  images exiftool origin176.jpeg
ExifTool Version Number         : 12.00
File Name                       : origin176.jpeg
Directory                       : .
File Size                       : 6.3 MB
File Modification Date/Time     : 2020:11:18 16:20:20+08:00
File Access Date/Time           : 2020:11:18 16:21:16+08:00
File Inode Change Date/Time     : 2020:11:18 16:24:07+08:00
File Permissions                : rw-------
File Type                       : JPEG
File Type Extension             : jpg
MIME Type                       : image/jpeg
Exif Byte Order                 : Big-endian (Motorola, MM)
Orientation                     : Rotate 180

The origin image has Orientation field

output image info:

➜  images exiftool 176.jpeg
ExifTool Version Number         : 12.00
File Name                       : 176.jpeg
Directory                       : .
File Size                       : 1496 kB
File Modification Date/Time     : 2020:11:18 16:24:41+08:00
File Access Date/Time           : 2020:11:18 16:26:18+08:00
File Inode Change Date/Time     : 2020:11:18 16:24:41+08:00
File Permissions                : rw-r--r--
File Type                       : JPEG
File Type Extension             : jpg
MIME Type                       : image/jpeg

And the output image info don't have Orientation field so my image was rotated 180 degree

@fintelia
Copy link
Contributor

I think we're a long way from being able to retain EXIF information (see #1045). A more likely short term goal might be to apply the orientation transform when loading the JPEG, but I wonder whether that might also produce surprising results for some users if they for instance load an image with orientation 90 and discover that width an height are swapped?

@fospring
Copy link
Author

Yes. Image-rs seems not method to get the Orientation, it's inconvenient to rotate image before compress a image.

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

No branches or pull requests

2 participants