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
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

OPTIONS

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              pnm_parsecolor()                 library                 routine
139              ⟨libnetpbm_image.html#colorname⟩          (e.g., "hotpink"    or
140              "#ff69b4").
141
142              If you specify neither --targetcolor nor --colorfile, pamrecolor
143              will  randomly select a target color for each pixel of the input
144              image.
145
146              You may not specify both -targetcolor and -colorfile.
147
148
149
150
151       --colorfile=file
152              Take per-pixel target colors from Netpbm file  file  instead  of
153              using  a  single target color for the entire image.  file should
154              be a PPM or color PAM image.  If the image in the file wider  or
155              taller  than  the input image, pamrecolor uses only the left and
156              top part of it.  If the image is narrower or shorter, pamrecolor
157              considers the image to be repeated in a tile pattern.
158
159              If you specify neither --targetcolor nor --colorfile, pamrecolor
160              will randomly select a target color for each pixel of the  input
161              image.
162
163              You may not specify both -targetcolor and -colorfile.
164
165
166       -randomseed=integer
167              This  is the seed for the random number generator that generates
168              the pixels.
169
170              Use this to ensure you get the same image  on  separate  invoca‐
171              tions.
172
173              By  default, pamrecolor uses a seed derived from the time of day
174              and process ID, which gives you fairly uncorrelated  results  in
175              multiple invocations.
176
177              This option was new in Netpbm 10.61 (December 2012).
178
179
180
181
182

EXAMPLES

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

NOTES

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

HISTORY

228       Scott Pakin wrote pamrecolor in July 2010.
229
230       pamrecolor was new in Netpbm 10.52 (September 2010).
231
232
233

AUTHOR

235       Copyright (C) 2010 Scott Pakin, scott+pbm@pakin.org.
236
237
238

SEE ALSO

240       ·
241
242              ppmtopgm(1)
243
244       ·
245
246              ppmchange(1)
247
248       ·
249
250              pnmremap(1)
251

DOCUMENT SOURCE

253       This manual page was generated by the Netpbm tool 'makeman'  from  HTML
254       source.  The master documentation is at
255
256              http://netpbm.sourceforge.net/doc/pamrecolor.html
257
258netpbm documentation             31 July 2010        Pamrecolor User Manual(0)
Impressum