Write ISOSpeed extension tag for ISO above 65534 in write_exif

Found while testing crates/meta/src/exif.rs:455 (write_exif)

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
NetterSilver
2026-10-19 05:16:03 +00:00
co-authored by Claude Haiku 5.5
parent d999e382ba
commit a3d00301cf
+9
View File
@@ -453,6 +453,7 @@ pub fn write_exif(meta: &Metadata) -> Vec<u8> {
(t::F_NUMBER, r(meta.f_number)),
(t::FOCAL_LENGTH, r(meta.focal_length)),
(t::ISO_SPEED, meta.iso.map(|i| Value::Short(vec![i.min(65_535) as u16]))),
(t::ISO_SPEED_RATINGS_EXT, meta.iso.filter(|&i| i > 65_534).map(|i| Value::Long(vec![i]))),
(t::LENS_MAKE, ascii(&meta.lens_make)),
(t::LENS_MODEL, ascii(&meta.lens_model)),
(t::EXPOSURE_BIAS, meta.exposure_bias.map(|v| Value::SRational(vec![srational(v)]))),
@@ -518,4 +519,12 @@ mod write_tests {
let g = back.gps.unwrap();
assert!((g.latitude - 43.7904).abs() < 1e-5 && (g.longitude + 110.6818).abs() < 1e-5, "{g:?}");
}
#[test]
fn iso_above_65534_round_trips() {
for iso in [65_534, 65_535, 102_400, 409_600] {
let back = read_exif(&write_exif(&Metadata { iso: Some(iso), ..Default::default() }));
assert_eq!(back.iso, Some(iso));
}
}
}