Skip to content

Commit

Permalink
Add a function to convert from Orientation to Exif values
Browse files Browse the repository at this point in the history
  • Loading branch information
Shnatsel committed Sep 13, 2024
1 parent b4cb2d6 commit 9c0d517
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/orientation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,17 @@ impl Orientation {
}
}

/// Converts into [Exif orientation](https://web.archive.org/web/20200412005226/https://www.impulseadventure.com/photo/exif-orientation.html)
pub fn to_exif(self) -> u8 {
match self {
Self::NoTransforms => 1,
Self::FlipHorizontal => 2,
Self::Rotate180 => 3,
Self::FlipVertical => 4,
Self::Rotate90FlipH => 5,
Self::Rotate90 => 6,
Self::Rotate270FlipH => 7,
Self::Rotate270 => 8,
}
}
}

0 comments on commit 9c0d517

Please sign in to comment.