[-closeness=closeness_percent] [-remainder=remainder_color] [-closeok]
[oldcolor newcolor] ... [ppmfile]

ppmchange red blue redimage.ppm >blueimage.ppm

ppmchange red red -remainder=black myimage.ppm >redblack.ppm

ppmchange -closeness=90 white white black black

This program is part of Netpbm.

ppmchange reads a PPM image as input and changes all pixels of colr
oldcolor to color newcolor.

You may specify up to 256 oldcolor/newcolor pairs on the command line.
ppmchange leaves all colors not mentioned unchanged, unless you spec-
ify the -remainder option, in which case they are all changed to the
single specified color.

You can specify that colors similar, but not identical, to the ones
you specify get replaced by specifying a 'closeness' factor.

Specify the colors as described for the argument of the ppm_parsec-
olor() library routine .

If a pixel matches two different oldcolors, ppmchange replaces it with
the newcolor of the leftmost specified one.

The maxval of the output image is the same as that of the input image.
If a newcolor you specify cannot be exactly represented in that max-
val, ppmchange assumes a color that is as close as possible to what
you specified but can be represented with your maxval. Unless you
specify the -closeok option, ppmchange issues a warning that it is
using an approximation.

A common way that you can have this maxval problem, where the color
you specify cannot be represented with your maxval, is that your input
is a PBM (black and white) image that you are colorizing. The maxval
in this case is 1, which severely limits the colors to which you can
change. To avoid this problem, use pamdepth to make the maxval of
your input something consistent with your colors. 255 is usually a
good choice.

Before Netpbm 10.22 (April 2004), ppmchange always behaved as if the
user specified -closeok and there was no -closeok option.

-closeness closeness_percent


-remainder color

pgmtoppm, ppmcolormask, ppm

Wilson H. Bent. Jr. ( with modifications by Alberto Acco-
mazzi (

netpbm documentation September 2005 Ppmchange User Manual(0)