1Pamrecolor User Manual(0)                            Pamrecolor User Manual(0)
2
3
4

NAME

6       pamrecolor - alter colors without affecting luminance
7
8

SYNOPSIS

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

DESCRIPTION

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 im‐
32       age.
33
34       In addition to real Netpbm images, pamrecolor  works  on  pseudo-Netpbm
35       images based on arbitrary color spaces.  You can define the color space
36       explicitly or choose one of many that pamrecolor knows by name.
37
38       The output is a PAM image on standard output.  Options control the  ex‐
39       act format of the PAM.  If you want a PNM (PBM, PGM, or PPM) image, use
40       pamtopnm(1) on the output.  There is no need to convert if you will use
41       the image as input to a current Netpbm program, but many other programs
42       don't know what a PAM is.
43
44
45

OPTIONS

47       In addition to the options common to all programs  based  on  libnetpbm
48       (most notably -quiet, see
49        Common Options ⟨index.html#commonoptions⟩ ), pamrecolor recognizes the
50       following command line options:
51
52
53
54
55       --colorspace=name
56              Designate the color space to use for determining  the  contribu‐
57              tion  to  luminance  of  each  of the red, green, and blue color
58              channels.  For example, in the SMPTE-C color space an RGB  color
59              is  converted  to  grayscale  by  multiplying the red channel by
60              0.2124132, the green channel by 0.7010437, and the blue  channel
61              by 0.0865432 and summing the resulting three products.
62
63              When  you  use  this option, the input and output images are not
64              true Netpbm images, because the Netpbm image format specifies  a
65              particular  color  space.  Instead, you are using a variation on
66              the format in which the sample values in the raster have differ‐
67              ent  meaning.   Many  programs that ostensibly use Netpbm images
68              actually use a variation with a different color space.  For  ex‐
69              ample,  GIMP ⟨http://www.gimp.org/⟩  uses sRGB internally and if
70              you have GIMP generate a Netpbm image file, it really  generates
71              a variation of the format that uses sRGB.
72
73              pamrecolor knows the following color spaces (name values):
74
75
76
77       adobe
78
79              Adobe RGB (1998) with a D65 reference white
80
81
82       apple
83
84              Apple  RGB with a D65 reference white
85
86
87       cie
88
89              CIE with an Illuminant E reference white
90
91
92       ntsc
93
94              NTSC RGB with an Illuminant C reference white
95
96
97       pal
98
99              PAL/SECAM with a D65 reference white
100
101
102       smpte-c
103
104              SMPTE-C with a D65 reference white
105
106
107       srgb
108
109              sRGB with a D65 reference white
110
111
112       wide
113
114              Wide-gamut RGB with a D50 reference white
115
116
117              The  default  is "ntsc" because this is the color space that the
118              Netpbm formats and many graphics utilities use.  As a counterex‐
119              ample,  GIMP  ⟨http://www.gimp.org/⟩    uses  sRGB as its native
120              color space.
121
122              The luminance values pamrecolor uses for each of the above  come
123              from  Bruce Lindbloom's  Computing RGB-to-XYZ and XYZ-to-RGB ma‐
124              trices" (1) page.
125
126
127       --rmult=fraction
128
129       --gmult=fraction
130
131       --bmult=fraction
132              Instead of selecting a color space by name, you can specify  ex‐
133              plicitly  the  contribution of each color channel to the overall
134              luminance as red, green, and blue multipliers.  These three  op‐
135              tions  must be used together, and the three fraction values must
136              sum to 1.0.  For example, you can specify  the  ProPhoto  (ROMM)
137              RGB   color   space  with  "--rmult=0.2880402  --gmult=0.7118741
138              --bmult=0.0000857".
139
140
141       --targetcolor=color
142              Designate color as the target color for the  image.   pamrecolor
143              will  make  each  pixel as close as possible to color subject to
144              the constraint that the luminance must stay the same as  in  the
145              original  image.   Specify  color  as  in  the  argument  of the
146              pnm_parsecolor()                 library                 routine
147              ⟨libnetpbm_image.html#colorname⟩          (e.g., "hotpink"    or
148              "#ff69b4").
149
150              If you specify neither --targetcolor nor --colorfile, pamrecolor
151              will  randomly select a target color for each pixel of the input
152              image.
153
154              You may not specify both -targetcolor and -colorfile.
155
156
157
158
159       --colorfile=file
160              Take per-pixel target colors from Netpbm file  file  instead  of
161              using  a  single target color for the entire image.  file should
162              be a PPM or color PAM image.  If the image in the file wider  or
163              taller  than  the input image, pamrecolor uses only the left and
164              top part of it.  If the image is narrower or shorter, pamrecolor
165              considers the image to be repeated in a tile pattern.
166
167              If you specify neither --targetcolor nor --colorfile, pamrecolor
168              will randomly select a target color for each pixel of the  input
169              image.
170
171              You may not specify both -targetcolor and -colorfile.
172
173
174       -randomseed=integer
175              This  is the seed for the random number generator that generates
176              the pixels.
177
178              Use this to ensure you get the same image  on  separate  invoca‐
179              tions.
180
181              By  default, pamrecolor uses a seed derived from the time of day
182              and process ID, which gives you fairly uncorrelated  results  in
183              multiple invocations.
184
185              This option was new in Netpbm 10.61 (December 2012).
186
187
188
189
190

EXAMPLES

192       This command tints an image yellow:
193
194           pamrecolor --targetcolor=yellow colorpic.pam > yellowpic.pam
195
196       This command takes the colors from colorpicture.ppm and applies them to
197       graypicture.pgm:
198
199           pamrecolor --colorfile=colorpic.ppm graypic.pgm > colorizedpic.pam
200
201       The  grayscale  version  of  colorizedpic.pam  will  look   just   like
202       graypic.pgm.   Note that if you use a non-Netpbm tool to do the conver‐
203       sion to grayscale, you may additionally need to specify an  appropriate
204       --colorspace value for your conversion tool.
205
206
207

NOTES

209       Here  are  a  couple of fun special effects you can produce with pamre‐
210       color:
211
212
213
214       •      Specify a color file that is identical to the  input  image  but
215              with some large, colored text added to it.  The text will "magi‐
216              cally" vanish when the image is converted to grayscale.
217
218
219       •      Provide a low-contrast grayscale image - perhaps a  secret  mes‐
220              sage written in similar shades of gray - as the input file and a
221              colorful but completely different image as the color  file.   If
222              done  carefully, the grayscale image can be hidden by the color‐
223              ful image.  Only people  who  know  to  convert  the  result  to
224              grayscale can recover the original grayscale image.
225
226
227       •      Use  --targetcolor=tan  to  make an image look like an old-timey
228              photograph  (or,  more  precisely,  a   sepia-toned   photograph
229http://en.wikipedia.org/wiki/Photographic_print_toning⟩  of the
230              late 1800s).
231
232
233
234

HISTORY

236       Scott Pakin wrote pamrecolor in July 2010.
237
238       pamrecolor was new in Netpbm 10.52 (September 2010).
239
240
241

AUTHOR

243       Copyright (C) 2010 Scott Pakin, scott+pbm@pakin.org
244
245
246

SEE ALSO

248
249
250              ppmtopgm(1)
251
252
253
254              ppmchange(1)
255
256
257
258              pnmremap(1)
259

DOCUMENT SOURCE

261       This manual page was generated by the Netpbm tool 'makeman'  from  HTML
262       source.  The master documentation is at
263
264              http://netpbm.sourceforge.net/doc/pamrecolor.html
265
266netpbm documentation             31 July 2010        Pamrecolor User Manual(0)
Impressum