B13: ec-image TIFF info() reports IFD0 orientation instead of always 1
Browse files at this commit8f9f453b224d63deb2968d1f905a9da27cea0facParent: 22f0f3f2 changed files +11 -2
crates/ec-image/src/tiff.rsmodified+1 -2
| @@ -340,8 +340,7 @@ pub fn info(data: &[u8]) -> Result<Info> { | |||
| 340 | format: ImageFormat::Tiff, | 340 | format: ImageFormat::Tiff, |
| 341 | width: layout.width, | 341 | width: layout.width, |
| 342 | height: layout.height, | 342 | height: layout.height, |
| 343 | - // Not read: TIFF orientation lives in the first directory, which `layout` does not keep. | 343 | + orientation: layout.orientation.unwrap_or(1), |
| 344 | - orientation: 1, | ||
| 345 | }) | 344 | }) |
| 346 | } | 345 | } |
| 347 | 346 | ||
crates/ec-image/tests/it/gaps.rsmodified+10 -0
| @@ -414,3 +414,13 @@ fn probing_arbitrary_mutations_never_panics() { | |||
| 414 | } | 414 | } |
| 415 | } | 415 | } |
| 416 | } | 416 | } |
| 417 | + | ||
| 418 | +#[test] | ||
| 419 | +fn tiff_info_reports_the_ifd0_orientation() { | ||
| 420 | + for o in 1..=8u16 { | ||
| 421 | + assert_eq!( | ||
| 422 | + ec_image::info(&tiff(o, false)).unwrap().orientation, | ||
| 423 | + o as u8 | ||
| 424 | + ); | ||
| 425 | + } | ||
| 426 | +} | ||