diff --git a/crates/raw/src/look.rs b/crates/raw/src/look.rs index c92a02ab6b..27c0a14993 100644 --- a/crates/raw/src/look.rs +++ b/crates/raw/src/look.rs @@ -849,7 +849,10 @@ mod tests { let cam: Vec<[f32; 3]> = patches(w, h).iter().map(|p| [0, 1, 2].map(|k| p[k] / WB[k] as f32)).collect(); let data = crate::testgen::mosaic(&cam, w, [0, 1, 1, 2], 0, 4095); let b = crate::testgen::tiff_ep("NIKON CORPORATION", w, h, &data, [0, 1, 1, 2], 12, vec![]); - let s = crate::decode(&b, &crate::Limits::default()).unwrap(); + let mut s = crate::decode(&b, &crate::Limits::default()).unwrap(); + // The data spans the full 12-bit range. craft-raw's NEF reader takes no WhiteLevel tag + // and reads the brightest flat, noiseless patch as a saturation plateau. + s.white = [4095.0; 3]; let to_srgb = color::invert(&color::srgb_to_xyz_d50()).unwrap(); let pro_to_srgb = color::mul(&to_srgb, &color::rgb_to_xyz(color::ROMM, color::D50_XY)); let f = |x: f64| 1.6 * x / (1.0 + 0.6 * x); diff --git a/crates/ui-egui/src/app/files.rs b/crates/ui-egui/src/app/files.rs index 3b0e71ffa8..1fa6b5ec16 100644 --- a/crates/ui-egui/src/app/files.rs +++ b/crates/ui-egui/src/app/files.rs @@ -97,8 +97,9 @@ impl PhotocraftApp { // A PSD and a magic-detected TIFF both go through the typed IO path: only it carries // `PsdApprovalRequired` (and, for a PSD, the structured damaged flag), so a layered // TIFF's high-memory decision can raise its prompt instead of becoming a terminal - // string. Every other format keeps the shell's import service. - let typed_open = photocraft_io::is_psd(bytes) || photocraft_formats::detect(name, bytes) == Some(photocraft_formats::Format::Tiff); + // string. Every other format keeps the shell's import service. `detect` gets no name: + // given one it falls back to the extension, and a `.tif` name alone is no TIFF. + let typed_open = photocraft_io::is_psd(bytes) || photocraft_formats::detect("", bytes) == Some(photocraft_formats::Format::Tiff); let (mut doc, warnings, damaged) = if typed_open { // Read PSD damage as structured information in the same decode, not by // retrying an error or matching the text of a compatibility warning. A TIFF never