diff --git a/crates/ec-image/src/tiff.rs b/crates/ec-image/src/tiff.rs index 986cc793..23ace55a 100644 --- a/crates/ec-image/src/tiff.rs +++ b/crates/ec-image/src/tiff.rs @@ -340,8 +340,7 @@ pub fn info(data: &[u8]) -> Result { format: ImageFormat::Tiff, width: layout.width, height: layout.height, - // Not read: TIFF orientation lives in the first directory, which `layout` does not keep. - orientation: 1, + orientation: layout.orientation.unwrap_or(1), }) } diff --git a/crates/ec-image/tests/it/gaps.rs b/crates/ec-image/tests/it/gaps.rs index d4b3aa0a..8c143847 100644 --- a/crates/ec-image/tests/it/gaps.rs +++ b/crates/ec-image/tests/it/gaps.rs @@ -414,3 +414,13 @@ fn probing_arbitrary_mutations_never_panics() { } } } + +#[test] +fn tiff_info_reports_the_ifd0_orientation() { + for o in 1..=8u16 { + assert_eq!( + ec_image::info(&tiff(o, false)).unwrap().orientation, + o as u8 + ); + } +}