pub(crate) mod exif;
pub(crate) mod transform;
use crate::{Image, Orientation};
pub(crate) fn apply_orientation_if_present(image: &mut Image, apply: bool) {
let Some(blob) = image.exif() else { return };
let Some(raw) = exif::parse_orientation(blob) else {
return;
};
let orientation = Orientation::from_exif(raw);
if orientation == Orientation::Normal {
return;
}
if !apply {
image.set_orientation(orientation);
return;
}
transform::bake_into_frames(image, orientation);
image.set_orientation(Orientation::Normal);
}