1Ppmchange User Manual(0)                              Ppmchange User Manual(0)
2
3
4

NAME

6       ppmchange - change all pixels of one color to another in a PPM image
7
8

SYNOPSIS

10       ppmchange
11
12       [-closeness=closeness_percent]  [-remainder=remainder_color] [-closeok]
13       [oldcolor newcolor] ...  [ppmfile]
14
15

EXAMPLES

17       ppmchange red blue redimage.ppm >blueimage.ppm
18
19       ppmchange red red -remainder=black myimage.ppm >redblack.ppm
20
21       ppmchange -closeness=10 white white black black
22
23
24
25

DESCRIPTION

27       This program is part of Netpbm(1).
28
29       ppmchange reads a PPM image as input and changes all  pixels  of  color
30       oldcolor to color newcolor.
31
32       You  may specify up to 256 oldcolor/newcolor pairs on the command line.
33       ppmchange leaves all colors not mentioned unchanged, unless you specify
34       the -remainder option, in which case they are all changed to the single
35       specified color.
36
37       You can specify that colors similar, but not identical, to the ones you
38       specify get replaced by specifying a "closeness" factor.
39
40       Specify   the   colors   as   described   for   the   argument  of  the
41       pnm_parsecolor() library routine ⟨libnetpbm_image.html#colorname⟩ .
42
43       If a pixel matches two different oldcolors, ppmchange replaces it  with
44       the newcolor of the leftmost specified one.
45
46       The  maxval of the output image is the same as that of the input image.
47       If a newcolor you specify cannot be exactly represented in that maxval,
48       ppmchange  assumes  a  color  that  is as close as possible to what you
49       specified but can be represented with your maxval.  Unless you  specify
50       the -closeok option, ppmchange issues a warning that it is using an ap‐
51       proximation.
52
53       A common way that you can have this maxval problem, where the color you
54       specify cannot be represented with your maxval, is that your input is a
55       PBM (black and white) image that you are  colorizing.   The  maxval  in
56       this  case  is  1,  which  severely  limits the colors to which you can
57       change.  To avoid this problem, use pamdepth to make the maxval of your
58       input  something  consistent  with  your colors.  255 is usually a good
59       choice.
60
61       Before Netpbm 10.22 (April 2004), ppmchange always behaved  as  if  the
62       user specified -closeok, and there was no -closeok option.
63
64
65

OPTIONS

67       In  addition  to  the options common to all programs based on libnetpbm
68       (most notably -quiet, see
69        Common Options ⟨index.html#commonoptions⟩ ), ppmchange recognizes  the
70       following command line options:
71
72
73
74       -closeness closeness_percent
75              closeness  is a percentage indicating how close to the color you
76              specified a pixel must be to get replaced.  By default, it is 0,
77              which means the pixel must be the exact color you specified.
78
79              A  pixel  gets  replaced if the distance in color between it and
80              the color you specified is less than or equal to  closeness  per
81              cent of the maxval.
82
83              The  "distance"  in color is defined as the Cartesian sum of the
84              individual differences in red, green, and blue  intensities  be‐
85              tween  the two pixels, normalized so that the difference between
86              black and white is 100%.
87
88              This is probably simpler than what you want most the time.   You
89              probably  would  like to change colors that have similar chromi‐
90              nance, regardless of their intensity.  So if there's a red  barn
91              that  is  variously  shadowed, you want the entire barn changed.
92              But because the shadowing significantly changes  the  color  ac‐
93              cording  to  ppmchange's distance formula, parts of the barn are
94              probably about as distant in color from other parts of the  barn
95              as they are from green grass next to the barn.
96
97              Maybe  ppmchange  will  be  enhanced  some day to do chrominance
98              analysis.
99
100              This option was new in Netpbm 9.8 (September 2000).
101
102
103       -closeok
104              This option affects how ppmchange interprets a color you specify
105              in  the  arguments.  When you specify this option, ppmchange may
106              use a color close to, but not the same as what you specify.  See
107              the description section ⟨#description⟩  for details.
108
109              This  option was new in Netpbm 10.22 (April 2004).  Before that,
110              ppmchange always behaved as if you specified this option.
111
112
113       -remainder color
114              ppmchange changes all pixels which are not of a color for  which
115              you specify an explicit replacement color on the command line to
116              color color.
117
118              An example application of this is
119
120              ppmchange -remainder=black red red
121
122
123              to lift only the red portions from an image, or
124              ppmchange -remainder=black red white | ppmtopgm
125
126
127              to create a mask file for the red portions of the image.
128
129
130
131

SEE ALSO

133       pgmtoppm(1), ppmcolormask(1), ppm(1)
134
135

AUTHOR

137       Wilson H. Bent. Jr. (whb@usc.edu) with modifications by  Alberto  Acco‐
138       mazzi (alberto@cfa.harvard.edu)
139

DOCUMENT SOURCE

141       This  manual  page was generated by the Netpbm tool 'makeman' from HTML
142       source.  The master documentation is at
143
144              http://netpbm.sourceforge.net/doc/ppmchange.html
145
146netpbm documentation             December 2016        Ppmchange User Manual(0)
Impressum