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

SEE ALSO

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

AUTHOR

126       Wilson  H.  Bent. Jr. (whb@usc.edu) with modifications by Alberto Acco‐
127       mazzi (alberto@cfa.harvard.edu)
128
129
130
131netpbm documentation            September 2005        Ppmchange User Manual(0)
Impressum