Merge pull request 'fix(#6): saturation uses libraw_set_saturation_mul instead of gamma' (#22) from fix/issue-6 into master

This commit is contained in:
jarianc 2026-07-05 09:49:00 -05:00
commit b6a3bc3219

View File

@ -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)