mirror of
https://github.com/storytold/lightcraft.git
synced 2026-10-26 19:17:02 -06:00
Merge PR #2294: Write ISOSpeed extension tag for ISO above 65534 in write_exif
This commit is contained in:
@@ -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));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user