Debian Codegraph @

upstream/fedora-44/man1/pamrecolor.1

raw
1 \
2 .\" This man page was generated by the Netpbm tool 'makeman' from HTML source.
3 .\" Do not hand-hack it! If you have bug fixes or improvements, please find
4 .\" the corresponding HTML page on the Netpbm website, generate a patch
5 .\" against that, and send it to the Netpbm maintainer.
6 .TH "Pamrecolor User Manual" 0 "31 July 2010" "netpbm documentation"
7 .PP
8
9
10 .SH NAME
11 pamrecolor - alter colors without affecting luminance
12
13 .UN synopsis
14 .SH SYNOPSIS
15 .PP
16 \fBpamrecolor\fP
17 [\fB--colorspace\fP=\fIname\fP]
18 [\fB--rmult\fP=\fIfraction\fP]
19 [\fB--gmult\fP=\fIfraction\fP]
20 [\fB--bmult\fP=\fIfraction\fP]
21 [\fB--targetcolor\fP=\fIcolor\fP]
22 [\fB--colorfile\fP=\fIfile\fP]
23 [\fB-randomseed=\fP\fIinteger\fP]
24
25 [\fIinfile\fP]
26
27 .PP
28 Minimum unique abbreviation of option is acceptable. You may use double
29 hyphens instead of single hyphen to denote options. You may use white
30 space in place of the equals sign to separate an option name from its value.
31
32 .UN description
33 .SH DESCRIPTION
34 .PP
35 This program is part of
36 .BR "Netpbm" (1)\c
37 \&.
38 .PP
39 \fBpamrecolor\fP changes an image's colors to be as close as
40 possible to given target colors but with the constraint that the
41 luminance not be modified. That is, the original image and the target
42 image will look identical if both are converted to grayscale
43 (e.g. with
44 .BR "ppmtopgm" (1)\c
45 \&). You can have \fBpamrecolor\fP select
46 target colors randomly, specify a single hue for the entire image, or take the
47 target colors from a target image.
48 .PP
49 In addition to real Netpbm images, \fBpamrecolor\fP works on pseudo-Netpbm
50 images based on arbitrary color spaces. You can define the color space
51 explicitly or choose one of many that \fBpamrecolor\fP knows by name.
52 .PP
53 The output is a PAM image on standard output. Options control the
54 exact format of the PAM. If you want a PNM (PBM, PGM, or PPM) image,
55 use
56 .BR "pamtopnm" (1)\c
57 \& on the output. There is no
58 need to convert if you will use the image as input to a current Netpbm
59 program, but many other programs don't know what a PAM is.
60
61
62 .UN options
63 .SH OPTIONS
64 .PP
65 In addition to the options common to all programs based on libnetpbm
66 (most notably \fB-quiet\fP, see
67 .UR index.html#commonoptions
68 Common Options
69 .UE
70 \&), \fBpamrecolor\fP recognizes the following
71 command line options:
72
73
74
75 .TP
76 \fB--colorspace\fP=\fIname\fP
77 Designate the color space to use for determining the contribution
78 to luminance of each of the red, green, and blue color channels. For
79 example, in the SMPTE-C color space an RGB color is converted to
80 grayscale by multiplying the red channel by 0.2124132, the green
81 channel by 0.7010437, and the blue channel by 0.0865432 and summing
82 the resulting three products.
83 .sp
84 When you use this option, the input and output images are not true Netpbm
85 images, because the Netpbm image format specifies a particular color space.
86 Instead, you are using a variation on the format in which the sample values in
87 the raster have different meaning. Many programs that ostensibly use Netpbm
88 images actually use a variation with a different color space. For example,
89 .UR http://www.gimp.org/
90 GIMP
91 .UE
92 \& uses sRGB internally and if you
93 have GIMP generate a Netpbm image file, it really generates a variation of
94 the format that uses sRGB.
95 .sp
96 \fBpamrecolor\fP knows the following color spaces (\fIname\fP values):
97
98
99 .TP
100 adobe
101
102 Adobe RGB (1998) with a D65 reference white
103
104 .TP
105 apple
106
107 Apple RGB with a D65 reference white
108
109 .TP
110 cie
111
112 CIE with an Illuminant E reference white
113
114 .TP
115 ntsc
116
117 NTSC RGB with an Illuminant C reference white
118
119 .TP
120 pal
121
122 PAL/SECAM with a D65 reference white
123
124 .TP
125 smpte-c
126
127 SMPTE-C with a D65 reference white
128
129 .TP
130 srgb
131
132 sRGB with a D65 reference white
133
134 .TP
135 wide
136
137 Wide-gamut RGB with a D50 reference white
138
139 .sp
140 The default is "ntsc" because this is the color space that the Netpbm
141 formats and many graphics utilities use. As a counterexample,
142 .UR http://www.gimp.org/
143 GIMP
144 .UE
145 \& uses sRGB as its native color
146 space.
147 .sp
148 The luminance values \fBpamrecolor\fP uses for each of the above come from
149 Bruce Lindbloom's
150 .BR "
151 Computing RGB-to-XYZ and XYZ-to-RGB matrices" (1)\c
152 \& page.
153
154 .TP
155 \fB--rmult\fP=\fIfraction\fP
156 .TP
157 \fB--gmult\fP=\fIfraction\fP
158 .TP
159 \fB--bmult\fP=\fIfraction\fP
160 Instead of selecting a color space by name, you can specify explicitly the
161 contribution of each color channel to the overall luminance as red, green, and
162 blue multipliers. These three options must be used together, and the
163 three \fIfraction\fP values must sum to 1.0. For example, you can specify
164 the ProPhoto (ROMM) RGB color space with
165 "\fB--rmult\fP=0.2880402 \fB--gmult\fP=0.7118741 \fB--bmult\fP=0.0000857".
166
167 .TP
168 \fB--targetcolor\fP=\fIcolor\fP
169 Designate \fIcolor\fP as the target color for the
170 image. \fBpamrecolor\fP will make each pixel as close as possible
171 to \fIcolor\fP subject to the constraint that the luminance must stay the
172 same as in the original image. Specify \fIcolor\fP as in
173 the
174 .UR libnetpbm_image.html#colorname
175 argument of the \fBpnm_parsecolor()\fP library routine
176 .UE
177 \& (e.g.,\ "hotpink" or "#ff69b4").
178 .sp
179 If you specify neither \fB--targetcolor\fP nor
180 \fB--colorfile\fP, \fBpamrecolor\fP will randomly select a target color for
181 each pixel of the input image.
182 .sp
183 You may not specify both \fB-targetcolor\fP and \fB-colorfile\fP.
184
185 .TP
186 \fB--colorfile\fP=\fIfile\fP
187 Take per-pixel target colors from Netpbm file \fIfile\fP instead
188 of using a single target color for the entire image.
189 \fIfile\fP should be a PPM or color PAM image.
190 If the image in the file wider or taller than the input image,
191 \fBpamrecolor\fP uses only the left and top part of it.
192 If the image is narrower or shorter, \fBpamrecolor\fP considers the
193 image to be repeated in a tile pattern.
194 .sp
195 If you specify neither \fB--targetcolor\fP nor
196 \fB--colorfile\fP, \fBpamrecolor\fP will randomly select a target color for
197 each pixel of the input image.
198 .sp
199 You may not specify both \fB-targetcolor\fP and \fB-colorfile\fP.
200
201 .TP
202 \fB-randomseed=\fP\fIinteger\fP
203 This is the seed for the random number generator that generates the
204 pixels.
205 .sp
206 Use this to ensure you get the same image on separate invocations.
207 .sp
208 By default, \fBpamrecolor\fP uses a seed derived from the time of day
209 and process ID, which gives you fairly uncorrelated results in multiple
210 invocations.
211 .sp
212 This option was new in Netpbm 10.61 (December 2012).
213
214
215 .UN examples
216 .SH EXAMPLES
217 .sp
218 This command tints an image yellow:
219
220 .nf
221 pamrecolor --targetcolor=yellow colorpic.pam > yellowpic.pam
222
223 .fi
224 .sp
225 This command takes the colors from \fBcolorpicture.ppm\fP and applies
226 them to \fBgraypicture.pgm\fP:
227
228 .nf
229 pamrecolor --colorfile=colorpic.ppm graypic.pgm > colorizedpic.pam
230
231 .fi
232 .sp
233 The grayscale version of \fBcolorizedpic.pam\fP will look just like
234 graypic.pgm. Note that if you use a non-Netpbm tool to do the conversion to
235 grayscale, you may additionally need to specify an
236 appropriate \fB--colorspace\fP value for your conversion tool.
237
238
239 .UN notes
240 .SH NOTES
241 .sp
242 Here are a couple of fun special effects you can produce with
243 \fBpamrecolor\fP:
244
245
246 .IP \(bu
247 Specify a color file that is identical to the input image but with
248 some large, colored text added to it. The text will "magically"
249 vanish when the image is converted to grayscale.
250
251 .IP \(bu
252 Provide a low-contrast grayscale image - perhaps a secret
253 message written in similar shades of gray - as the input file and
254 a colorful but completely different image as the color file. If done
255 carefully, the grayscale image can be hidden by the colorful image.
256 Only people who know to convert the result to grayscale can recover
257 the original grayscale image.
258
259 .IP \(bu
260 Use \fB--targetcolor\fP=tan to make an image look like an
261 old-timey photograph (or, more precisely, a
262 .UR http://en.wikipedia.org/wiki/Photographic_print_toning
263 sepia-toned photograph
264 .UE
265 \& of the late 1800s).
266
267
268
269 .UN history
270 .SH HISTORY
271 .sp
272 Scott Pakin wrote \fBpamrecolor\fP in July 2010.
273 .sp
274 \fBpamrecolor\fP was new in Netpbm 10.52 (September 2010).
275
276
277 .UN author
278 .SH AUTHOR
279 .sp
280 Copyright (C) 2010 Scott
281 Pakin, \[email protected]\fP
282
283
284 .UN seealso
285 .SH SEE ALSO
286
287
288 .IP \(bu
289 .BR "\fBppmtopgm\fP" (1)\c
290 \&
291 .IP \(bu
292 .BR "\fBppmchange\fP" (1)\c
293 \&
294 .IP \(bu
295 .BR "\fBpnmremap\fP" (1)\c
296 \&
297 .SH DOCUMENT SOURCE
298 This manual page was generated by the Netpbm tool 'makeman' from HTML
299 source. The master documentation is at
300 .IP
301 .B http://netpbm.sourceforge.net/doc/pamrecolor.html
302 .PP