about summary refs log tree commit diff
path: root/editor/ppmcolormask.c
diff options
context:
space:
mode:
Diffstat (limited to 'editor/ppmcolormask.c')
-rw-r--r--editor/ppmcolormask.c7
1 files changed, 6 insertions, 1 deletions
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