[gimp] Issue #5219 - Color>Info>Export histogram counts pixels twice



commit 6a01bf2df28e7aaf2deee8c402d9ed3673569463
Author: Ell <ell_se yahoo com>
Date:   Sun Jun 14 17:00:22 2020 +0300

    Issue #5219 - Color>Info>Export histogram counts pixels twice
    
    gimp_histogram() takes an inclusive range -- the plug-in has been
    counting non-zero pixels twice.

 plug-ins/pygimp/plug-ins/histogram-export.py | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
---
diff --git a/plug-ins/pygimp/plug-ins/histogram-export.py b/plug-ins/pygimp/plug-ins/histogram-export.py
index 4f8bd69e7f..11da1ba5b4 100755
--- a/plug-ins/pygimp/plug-ins/histogram-export.py
+++ b/plug-ins/pygimp/plug-ins/histogram-export.py
@@ -64,13 +64,14 @@ def histogram_export(img, drw, filename,
         writer.writerow(["Range start"] + channels_txt)
 
         # FIXME: Will need a specialized 'range' for FP color numbers
-        for start_range in range(0, 256, int(bucket_size)):
+        bucket_size = int(bucket_size)
+        for start_range in range(0, 256, bucket_size):
             row = [start_range]
             for channel in channels_gimp:
                 result = pdb.gimp_histogram(
                              drw, channel,
                              start_range,
-                             min(start_range + bucket_size, 255)
+                             min(start_range + bucket_size - 1, 255)
                             )
                 if output_format == "pixel count":
                     count = result[4]


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]