From 054acd3cc96b7c60ee07480f8513359e98fdded7 Mon Sep 17 00:00:00 2001 From: isiko Date: Tue, 6 Jun 2023 13:09:46 +0200 Subject: [PATCH] Fix Levels Node (#1289) The Levels Node was previously outputing channel values out side the range of 0..1, this should be fixed now --- node-graph/gcore/src/raster/adjustments.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/node-graph/gcore/src/raster/adjustments.rs b/node-graph/gcore/src/raster/adjustments.rs index c8aa6669..021f8556 100644 --- a/node-graph/gcore/src/raster/adjustments.rs +++ b/node-graph/gcore/src/raster/adjustments.rs @@ -261,7 +261,7 @@ fn levels_node(color: Color, input_start: f64, input_mid: f64, input_end: f64, o // Input levels (Range: 0-1) let highlights_minus_shadows = (input_highlights - input_shadows).max(f32::EPSILON).min(1.); - let color = color.map_rgb(|c| (c - input_shadows).max(0.) / highlights_minus_shadows); + let color = color.map_rgb(|c| ((c - input_shadows).max(0.) / highlights_minus_shadows).min(1.)); // Midtones (Range: 0-1) let color = color.gamma(gamma);