From 9b6fa05fecb7a3100cebfe3a984ece3c4a87cf4b Mon Sep 17 00:00:00 2001 From: Alx Sa Date: Wed, 14 Jun 2023 21:09:21 +0000 Subject: [PATCH] widgets: Fix RGB histogram pixel/count values The RGB histogram shows three histograms overlaid on each other. This multiples the pixel and count attributes by 3. To correct this, the result of gimp_histogram_get_count () is divided by 3 for the pixel and count displays. (cherry picked from commit bf1e125138ff17dc3f610be4f09345aecd6c3a5b) --- app/widgets/gimphistogrameditor.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/app/widgets/gimphistogrameditor.c b/app/widgets/gimphistogrameditor.c index ae21eec5ea..319243c7c2 100644 --- a/app/widgets/gimphistogrameditor.c +++ b/app/widgets/gimphistogrameditor.c @@ -712,6 +712,14 @@ gimp_histogram_editor_info_update (GimpHistogramEditor *editor) count = gimp_histogram_get_count (hist, view->channel, view->start, view->end); + /* For the RGB histogram, we need to divide by three + * since it combines three histograms in one */ + if (view->channel == GIMP_HISTOGRAM_RGB) + { + pixels /= 3; + count /= 3; + } + g_snprintf (text, sizeof (text), "%.3f", gimp_histogram_get_mean (hist, view->channel, view->start, view->end));