version 1 showing authors affecting page license.
.
Rev |
Author |
# |
Line |
1 |
perry |
1 |
ppmchange |
|
|
2 |
!!!ppmchange |
|
|
3 |
NAME |
|
|
4 |
SYNOPSIS |
|
|
5 |
DESCRIPTION |
|
|
6 |
OPTIONS |
|
|
7 |
SEE ALSO |
|
|
8 |
AUTHOR |
|
|
9 |
---- |
|
|
10 |
!!NAME |
|
|
11 |
|
|
|
12 |
|
|
|
13 |
ppmchange - change all pixels of one color to another in a portable pixmap |
|
|
14 |
!!SYNOPSIS |
|
|
15 |
|
|
|
16 |
|
|
|
17 |
__ppmchange__ [[ __-closeness__ |
|
|
18 |
''closeness_percent'' ] [[ __-remainder__ |
|
|
19 |
''remainder_color'' ] [[ ''oldcolor newcolor'' ] ... |
|
|
20 |
[[''ppmfile''] |
|
|
21 |
!!DESCRIPTION |
|
|
22 |
|
|
|
23 |
|
|
|
24 |
Reads a portable pixmap as input. Changes all pixels of |
|
|
25 |
''oldcolor'' to ''newcolor''. You may specify up to |
|
|
26 |
256 oldcolor/newcolor pairs on the command line. |
|
|
27 |
__ppmchange__ leaves all colors not mentioned unchanged, |
|
|
28 |
unless you specify the __-remainder__ option, in which |
|
|
29 |
case they are all changed to the single specified |
|
|
30 |
color. |
|
|
31 |
|
|
|
32 |
|
|
|
33 |
You can specify that colors similar, but not identical, to |
|
|
34 |
the ones you specify get replaced by specifying a |
|
|
35 |
|
|
|
36 |
|
|
|
37 |
The colors can be specified in five ways: |
|
|
38 |
|
|
|
39 |
|
|
|
40 |
o |
|
|
41 |
|
|
|
42 |
|
|
|
43 |
A name, assuming that a pointer to an X11-style color names |
|
|
44 |
file was compiled in. |
|
|
45 |
|
|
|
46 |
|
|
|
47 |
o |
|
|
48 |
|
|
|
49 |
|
|
|
50 |
An X11-style hexadecimal specifier: rgb:r/g/b, where r g and |
|
|
51 |
b are each 1- to 4-digit hexadecimal numbers. |
|
|
52 |
|
|
|
53 |
|
|
|
54 |
o |
|
|
55 |
|
|
|
56 |
|
|
|
57 |
An X11-style decimal specifier: rgbi:r/g/b, where r g and b |
|
|
58 |
are floating point numbers between 0 and 1. |
|
|
59 |
|
|
|
60 |
|
|
|
61 |
o |
|
|
62 |
|
|
|
63 |
|
|
|
64 |
For backwards compatibility, an old-X11-style hexadecimal |
|
|
65 |
number: #rgb, #rrggbb, #rrrgggbbb, or |
|
|
66 |
#rrrrggggbbbb. |
|
|
67 |
|
|
|
68 |
|
|
|
69 |
o |
|
|
70 |
|
|
|
71 |
|
|
|
72 |
For backwards compatibility, a triplet of numbers separated |
|
|
73 |
by commas: r,g,b, where r g and b are floating point numbers |
|
|
74 |
between 0 and 1. (This style was added before MIT came up |
|
|
75 |
with the similar rgbi style.) |
|
|
76 |
|
|
|
77 |
|
|
|
78 |
If a pixel matches two different ''oldcolor''s, |
|
|
79 |
__ppmchange__ replaces it with the ''newcolor'' of the |
|
|
80 |
leftmost specified one. |
|
|
81 |
!!OPTIONS |
|
|
82 |
|
|
|
83 |
|
|
|
84 |
__-closeness__ ''closeness_percent'' |
|
|
85 |
|
|
|
86 |
|
|
|
87 |
''closeness'' is an integer per centage indicating how |
|
|
88 |
close to the color you specified a pixel must be to get |
|
|
89 |
replaced. By default, it is 0, which means the pixel must be |
|
|
90 |
the exact color you specified. |
|
|
91 |
|
|
|
92 |
|
|
|
93 |
A pixel gets replaced if the distance in color between it |
|
|
94 |
and the color you specified is less than or equal to |
|
|
95 |
''closeness''. |
|
|
96 |
|
|
|
97 |
|
|
|
98 |
The |
|
|
99 |
|
|
|
100 |
|
|
|
101 |
This is probably simpler than what you want most the time. |
|
|
102 |
You probably would like to change colors that have similar |
|
|
103 |
chrominance, regardless of their intensity. So if there's a |
|
|
104 |
red barn that is variously shadowed, you want the entire |
|
|
105 |
barn changed. But because the shadowing significantly |
|
|
106 |
changes the color according to __ppmchange__'s distance |
|
|
107 |
formula, parts of the barn are probably about as distant in |
|
|
108 |
color from other parts of the barn as they are from green |
|
|
109 |
grass next to the barn. |
|
|
110 |
|
|
|
111 |
|
|
|
112 |
Maybe __ppmchange__ will be enhanced some day to do |
|
|
113 |
chrominance analysis. |
|
|
114 |
|
|
|
115 |
|
|
|
116 |
__-remainder__ ''color'' |
|
|
117 |
|
|
|
118 |
|
|
|
119 |
__ppmchange__ changes all pixels which are not of a color |
|
|
120 |
for which you specify an explicit replacement color on the |
|
|
121 |
command line to color ''color''. |
|
|
122 |
|
|
|
123 |
|
|
|
124 |
An example application of this is |
|
|
125 |
|
|
|
126 |
|
|
|
127 |
__ppmchange -remainder=black red red__ |
|
|
128 |
|
|
|
129 |
|
|
|
130 |
to lift only the red portions from an image, or |
|
|
131 |
|
|
|
132 |
|
|
|
133 |
__ppmchange -remainder=black red white | |
|
|
134 |
ppmtopgm__ |
|
|
135 |
|
|
|
136 |
|
|
|
137 |
to create a mask file for the red portions of the |
|
|
138 |
image. |
|
|
139 |
!!SEE ALSO |
|
|
140 |
|
|
|
141 |
|
|
|
142 |
pgmtoppm(1), ppmcolormask(1), |
|
|
143 |
ppm(5) |
|
|
144 |
!!AUTHOR |
|
|
145 |
|
|
|
146 |
|
|
|
147 |
Wilson H. Bent. Jr. (whb@usc.edu) with modifications by |
|
|
148 |
Alberto Accomazzi (alberto@cfa.harvard.edu) |
|
|
149 |
---- |