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

DESCRIPTION

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

OPTIONS

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

SEE ALSO

123       pgmtoppm(1), ppmcolormask(1), ppm(1)
124
125

AUTHOR

127       Wilson H. Bent. Jr. (whb@usc.edu) with modifications by  Alberto  Acco‐
128       mazzi (alberto@cfa.harvard.edu)
129

DOCUMENT SOURCE

131       This  manual  page was generated by the Netpbm tool 'makeman' from HTML
132       source.  The master documentation is at
133
134              http://netpbm.sourceforge.net/doc/ppmchange.html
135
136netpbm documentation             December 2016        Ppmchange User Manual(0)
Impressum