about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--doc/HISTORY5
-rw-r--r--editor/ppmcolormask.c7
-rw-r--r--version.mk2
3 files changed, 12 insertions, 2 deletions
diff --git a/doc/HISTORY b/doc/HISTORY
index 7aec1771..6f16efe6 100644
--- a/doc/HISTORY
+++ b/doc/HISTORY
@@ -4,6 +4,11 @@ Netpbm.
 CHANGE HISTORY 
 --------------
 
+17.06.30 BJH  Release 10.73.13
+
+              ppmcolormask: fix incorrect output when input maxval is not 255.
+              Always broken (ppmcolormask was new in Netpbm 9.0, April 2000).
+
 17.06.28 BJH  Release 10.73.12
 
               pamgauss: Fix skewed output with even dimension.  Always broken
diff --git a/editor/ppmcolormask.c b/editor/ppmcolormask.c
index 31fbff2a..5ef8d1c1 100644
--- a/editor/ppmcolormask.c
+++ b/editor/ppmcolormask.c
@@ -222,7 +222,12 @@ main(int argc, char *argv[]) {
             int col;
             ppm_readppmrow(ifP, inputRow, cols, maxval, format);
             for (col = 0; col < cols; ++col) {
-                if (colorIsInSet(inputRow[col], maxval, cmdline)) {
+                pixel thisColor;
+                    /* Color of this pixel with same maxval as used in
+                       'cmdline'
+                    */
+                PPM_DEPTH(thisColor, inputRow[col], maxval, PPM_MAXMAXVAL);
+                if (colorIsInSet(thisColor, PPM_MAXMAXVAL, cmdline)) {
                     maskRow[col] = PBM_BLACK;
                     ++numPixelsMasked;
                 } else 
diff --git a/version.mk b/version.mk
index 74120acb..f5c26e84 100644
--- a/version.mk
+++ b/version.mk
@@ -1,3 +1,3 @@
 NETPBM_MAJOR_RELEASE = 10
 NETPBM_MINOR_RELEASE = 73
-NETPBM_POINT_RELEASE = 12
+NETPBM_POINT_RELEASE = 13