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