Skip to main content

smriti/services/
image_utils.rs

1use image::DynamicImage;
2
3/// Apply EXIF orientation transform to decoded image pixels.
4pub fn apply_exif_orientation(img: DynamicImage, orientation: i32) -> DynamicImage {
5    match orientation {
6        2 => img.fliph(),
7        3 => img.rotate180(),
8        4 => img.flipv(),
9        5 => img.rotate90().fliph(),
10        6 => img.rotate90(),
11        7 => img.rotate270().fliph(),
12        8 => img.rotate270(),
13        _ => img,
14    }
15}