From 877773daaafe8576116a4d8fe68b6b765c99286b Mon Sep 17 00:00:00 2001 From: Bruno-Alumn <171815746+Bruno-Alumn@users.noreply.github.com> Date: Sat, 14 Nov 2026 23:26:50 +0100 Subject: [PATCH] craft-raw: keep the multipliers a Sony M / S ARW was balanced with (ColorData::balanced_with) --- crates/raw/src/arw.rs | 10 +++++++++- crates/raw/src/dng.rs | 1 + crates/raw/src/lib.rs | 6 ++++++ 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/crates/raw/src/arw.rs b/crates/raw/src/arw.rs index 639fc00327..ed2ecdf6a6 100644 --- a/crates/raw/src/arw.rs +++ b/crates/raw/src/arw.rs @@ -830,7 +830,12 @@ pub(crate) fn decode(bytes: &[u8], mode: Mode, limits: &Limits) -> Result ColorData { baseline_sharpness: get(t::BASELINE_SHARPNESS).and_then(|v| v.first().copied()).filter(|v| v.is_finite() && *v > 0.0 && *v <= 16.0), profile: profile_look(ifd0, raw, order), kelvin_presets: None, + balanced_with: None, } } diff --git a/crates/raw/src/lib.rs b/crates/raw/src/lib.rs index dbcf6f9531..c69172e145 100644 --- a/crates/raw/src/lib.rs +++ b/crates/raw/src/lib.rs @@ -995,6 +995,12 @@ pub struct ColorData { /// matrices a Kelvin scale ([`kelvin`]). Not a DNG tag: the DNG writer does not write it. #[serde(default)] pub kelvin_presets: Option, + /// The as-shot multipliers (green = 1) the samples were already balanced with. Sony's downsized lossless (M / S) + /// ARWs store white-balanced linear YCbCr, so their `wb_multipliers` are unit and the data renders as delivered; + /// a white balance scale reads As Shot from these instead (storytold/lightcraft#4078). Not a DNG tag: the DNG + /// writer does not write it. + #[serde(default, skip_serializing_if = "Option::is_none")] + pub balanced_with: Option<[f32; 3]>, } /// A decoded raw image.