Skip to content

Commit

Permalink
exif: Always return an orientation, default to Id
Browse files Browse the repository at this point in the history
  • Loading branch information
sophie-h committed May 27, 2024
1 parent f670495 commit bae0a89
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,10 @@ cast_possible_truncation = "forbid"
cast_possible_wrap = "forbid"

[workspace.dependencies]
gufo-exif = { path = "gufo-exif" }
gufo-common = { path = "gufo-common" }
gufo-exif = { path = "gufo-exif" }
gufo-jpeg = { path = "gufo-jpeg" }
gufo-xmp = { path = "gufo-xmp" }
once_cell = "1.19.0"
paste = "1.0.15"
serde = { version = "1.0.202", features = ["derive"] }
gufo-xmp = { path = "gufo-xmp" }
12 changes: 6 additions & 6 deletions gufo-exif/src/high_level.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,17 +25,17 @@ impl Exif {
///
/// Rotation and mirroring that have to be applied to show the image
/// correctly
pub fn orientation(&self) -> Option<orientation::Orientation> {
let num = self
.decoder
pub fn orientation(&self) -> orientation::Orientation {
self.decoder
.borrow_mut()
.lookup_short(TagIfd::new(
field::Orientation::TAG,
field::Orientation::IFD,
))
.ok()??;

orientation::Orientation::try_from(num).ok()
.ok()
.flatten()
.and_then(|x| orientation::Orientation::try_from(x).ok())
.unwrap_or(orientation::Orientation::Id)
}

/// Camera manifacturer
Expand Down

0 comments on commit bae0a89

Please sign in to comment.