1Pamrecolor User Manual(0) Pamrecolor User Manual(0)
2
3
4
6 pamrecolor - alter colors without affecting luminance
7
8
10 pamrecolor [--colorspace=name] [--rmult=fraction] [--gmult=fraction]
11 [--bmult=fraction] [--targetcolor=color] [--colorfile=file] [-random‐
12 seed=integer]
13
14 [infile]
15
16
17 Minimum unique abbreviation of option is acceptable. You may use dou‐
18 ble hyphens instead of single hyphen to denote options. You may use
19 white space in place of the equals sign to separate an option name from
20 its value.
21
22
24 This program is part of Netpbm(1).
25
26 pamrecolor changes an image's colors to be as close as possible to
27 given target colors but with the constraint that the luminance not be
28 modified. That is, the original image and the target image will look
29 identical if both are converted to grayscale (e.g. with ppmtopgm(1)).
30 You can have pamrecolor select target colors randomly, specify a single
31 hue for the entire image, or take the target colors from a target
32 image.
33
34 pamrecolor works on pseudo-Netpbm images based on arbitrary color spa‐
35 ces. You can define the color space explicitly or choose one of many
36 that pamrecolor knows by name.
37
38 The output is a PAM image on standard output. Options control the
39 exact format of the PAM. If you want a PNM (PBM, PGM, or PPM) image,
40 use pamtopnm(1) on the output. There is no need to convert if you will
41 use the image as input to a current Netpbm program, but many other pro‐
42 grams don't know what a PAM is.
43
44
45
47 --colorspace=name
48 Designate the color space to use for determining the contribu‐
49 tion to luminance of each of the red, green, and blue color
50 channels. For example, in the SMPTE-C color space an RGB color
51 is converted to grayscale by multiplying the red channel by
52 0.2124132, the green channel by 0.7010437, and the blue channel
53 by 0.0865432 and summing the resulting three products.
54
55 When you use this option, the input and output images are not
56 true Netpbm images, because the Netpbm image format specifies a
57 particular color space. Instead, you are using a variation on
58 the format in which the sample values in the raster have differ‐
59 ent meaning. Many programs that ostensibly use Netpbm images
60 actually use a variation with a different color space. For
61 example, GIMP ⟨http://www.gimp.org/⟩ uses sRGB internally and
62 if you have GIMP generate a Netpbm image file, it really gener‐
63 ates a variation of the format that uses sRGB.
64
65 pamrecolor knows the following color spaces (name values):
66
67
68
69 adobe
70
71 Adobe RGB (1998) with a D65 reference white
72
73
74 apple
75
76 Apple RGB with a D65 reference white
77
78
79 cie
80
81 CIE with an Illuminant E reference white
82
83
84 ntsc
85
86 NTSC RGB with an Illuminant C reference white
87
88
89 pal
90
91 PAL/SECAM with a D65 reference white
92
93
94 smpte-c
95
96 SMPTE-C with a D65 reference white
97
98
99 srgb
100
101 sRGB with a D65 reference white
102
103
104 wide
105
106 Wide-gamut RGB with a D50 reference white
107
108
109 The default is "ntsc" because this is the color space that the
110 Netpbm formats and many graphics utilities use. As a counterex‐
111 ample, GIMP ⟨http://www.gimp.org/⟩ uses sRGB as its native
112 color space.
113
114 The luminance values pamrecolor uses for each of the above come
115 from Bruce Lindbloom's Computing RGB-to-XYZ and XYZ-to-RGB
116 matrices" (1) page.
117
118
119 --rmult=fraction
120
121 --gmult=fraction
122
123 --bmult=fraction
124 Instead of selecting a color space by name, you can specify
125 explicitly the contribution of each color channel to the overall
126 luminance as red, green, and blue multipliers. These three
127 options must be used together, and the three fraction values
128 must sum to 1.0. For example, you can specify the ProPhoto
129 (ROMM) RGB color space with "--rmult=0.2880402 --gmult=0.7118741
130 --bmult=0.0000857".
131
132
133 --targetcolor=color
134 Designate color as the target color for the image. pamrecolor
135 will make each pixel as close as possible to color subject to
136 the constraint that the luminance must stay the same as in the
137 original image. Specify color as in the argument of the
138 ppm_parsecolor() library routine ⟨libppm.html#colorname⟩
139 (e.g., "hotpink" or "#ff69b4").
140
141 If you specify neither --targetcolor nor --colorfile, pamrecolor
142 will randomly select a target color for each pixel of the input
143 image.
144
145 You may not specify both -targetcolor and -colorfile.
146
147
148
149
150 --colorfile=file
151 Take per-pixel target colors from Netpbm file file instead of
152 using a single target color for the entire image. file should
153 be a PPM or color PAM image. If the image in the file wider or
154 taller than the input image, pamrecolor uses only the left and
155 top part of it. If the image is narrower or shorter, pamrecolor
156 considers the image to be repeated in a tile pattern.
157
158 If you specify neither --targetcolor nor --colorfile, pamrecolor
159 will randomly select a target color for each pixel of the input
160 image.
161
162 You may not specify both -targetcolor and -colorfile.
163
164
165 -randomseed=integer
166 This is the seed for the random number generator that generates
167 the pixels.
168
169 Use this to ensure you get the same image on separate invoca‐
170 tions.
171
172 By default, pamrecolor uses a seed derived from the time of day
173 and process ID, which gives you fairly uncorrelated results in
174 multiple invocations.
175
176 This option was new in Netpbm 10.61 (December 2012).
177
178
179
180
181
183 This command tints an image yellow:
184
185 pamrecolor --targetcolor=yellow colorpic.pam > yellowpic.pam
186
187 This command takes the colors from colorpicture.ppm and applies them to
188 graypicture.pgm:
189
190 pamrecolor --colorfile=colorpic.ppm graypic.pgm > colorizedpic.pam
191
192 The grayscale version of colorizedpic.pam will look just like
193 graypic.pgm. Note that if you use a non-Netpbm tool to do the conver‐
194 sion to grayscale, you may additionally need to specify an appropriate
195 --colorspace value for your conversion tool.
196
197
198
200 Here are a couple of fun special effects you can produce with pamre‐
201 color:
202
203
204
205 · Specify a color file that is identical to the input image but
206 with some large, colored text added to it. The text will "magi‐
207 cally" vanish when the image is converted to grayscale.
208
209
210 · Provide a low-contrast grayscale image - perhaps a secret mes‐
211 sage written in similar shades of gray - as the input file and a
212 colorful but completely different image as the color file. If
213 done carefully, the grayscale image can be hidden by the color‐
214 ful image. Only people who know to convert the result to
215 grayscale can recover the original grayscale image.
216
217
218 · Use --targetcolor=tan to make an image look like an old-timey
219 photograph (or, more precisely, a sepia-toned photograph
220 ⟨http://en.wikipedia.org/wiki/Photographic_print_toning⟩ of the
221 late 1800s).
222
223
224
225
227 Scott Pakin wrote pamrecolor in July 2010.
228
229 pamrecolor was new in Netpbm 10.52 (September 2010).
230
231
232
234 Copyright (C) 2010 Scott Pakin, scott+pbm@pakin.org.
235
236
237
239 ·
240
241 ppmtopgm(1)
242
243 ·
244
245 ppmchange(1)
246
247 ·
248
249 pnmremap(1)
250
252 This manual page was generated by the Netpbm tool 'makeman' from HTML
253 source. The master documentation is at
254
255 http://netpbm.sourceforge.net/doc/pamrecolor.html
256
257netpbm documentation 31 July 2010 Pamrecolor User Manual(0)