From 148e6cb0cbe546f6f436ca743f92036406057ef9 Mon Sep 17 00:00:00 2001 From: opencode Date: Sun, 5 Jul 2026 14:48:56 +0000 Subject: [PATCH] fix(#6): use libraw_set_saturation_mul instead of libraw_set_gamma for saturation --- src/main.rs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/main.rs b/src/main.rs index 24d5793..eb6d1eb 100644 --- a/src/main.rs +++ b/src/main.rs @@ -335,10 +335,11 @@ fn apply_image_parameters(lr: *mut libraw_data_t, args: &Args) { libraw_set_use_auto_wb(lr, 0); } - // Apply saturation + // Apply saturation (use saturation multiplier, not gamma) if args.saturation != 0 && !lr.is_null() { - let value = 1.0 + args.saturation.min(100).max(-100) as f32 / 100.0; - libraw_set_gamma(lr, 0, value); // Apply gamma adjustment to simulate saturation + let mul = (256i32 + args.saturation.min(100).max(-100) as i32 * 2) as c_int; + let sat_mul = [mul, mul, mul, mul]; + libraw_set_saturation_mul(lr, sat_mul.as_ptr()); } // Set output color space (sRGB in this case)