Pamrecolor User Manual(0) Pamrecolor User Manual(0)NAMEpamrecolor - alter colors without affecting luminance
SYNOPSISpamrecolor [--colorspace=name] [--rmult=fraction] [--gmult=fraction]
[--bmult=fraction] [--targetcolor=color] [--colorfile=file] [infile]
Minimum unique abbreviation of option is acceptable. You may use dou‐
ble hyphens instead of single hyphen to denote options. You may use
white space in place of the equals sign to separate an option name from
its value.
DESCRIPTION
This program is part of Netpbm(1).
pamrecolor changes an image's colors to be as close as possible to
given target colors but with the constraint that the luminance not be
modified. That is, the original image and the target image will look
identical if both are converted to grayscale (e.g. with ppm‐
topgm(1)).Youcanhavepamrecolorselect target colors randomly, specify a
single hue for the entire image, or take the target colors from a tar‐
get image.
pamrecolor works on pseudo-Netpbm images based on arbitrary color spa‐
ces. You can define the color space explicitly or choose on of many
that pamrecolor knows by name.
The output is a PAM image on standard output. Options control the
exact format of the PAM. If you want a PNM (PBM, PGM, or PPM) image,
use pamtopnm(1)ontheoutput.Thereisno need to convert if you will use
the image as input to a current Netpbm program, but many other programs
don't know what a PAM is.
OPTIONS
--colorspace=name
Designate the color space to use for determining the contribu‐
tion to luminance of each of the red, green, and blue color
channels. For example, in the SMPTE-C color space an RGB color
is converted to grayscale by multiplying the red channel by
0.2124132, the green channel by 0.7010437, and the blue channel
by 0.0865432 and summing the resulting three products.
When you use this option, the input and output images are not
true Netpbm images, because the Netpbm image format specifies a
particular color space. Instead, you are using a variation on
the format in which the sample values in the raster have differ‐
ent meaning. Many programs that ostensibly use Netpbm images
actually use a variation with a different color space, For exam‐
ple, GIMP ⟨http://www.gimp.org/⟩ uses sRGB internally and if
you have GIMP generate a Netpbm image file, it really generates
a variation of the format that uses sRGB.
pamrecolor knows the following color spaces (name values):
adobe
Adobe RGB (1998) with a D65 reference white
apple
Apple RGB with a D65 reference white
cie
CIE with an Illuminant E reference white
ntsc
NTSC RGB with an Illuminant C reference white
pal
PAL/SECAM with a D65 reference white
smpte-c
SMPTE-C with a D65 reference white
srgb
sRGB with a D65 reference white
wide
Wide-gamut RGB with a D50 reference white
The default is <q>ntsc</q> because this is the color space that
the Netpbm format of Netpbm and many other graphics utilities.
As a counterexample, GIMP ⟨http://www.gimp.org/⟩ uses sRGB as
its native color space.
The luminance values pamrecolor uses for each of the above come
from Bruce Lindbloom's Computing RGB-to-XYZ and XYZ-to-RGB
matrices (1) page.
--rmult=fraction
--gmult=fraction
--bmult=fraction
Instead of selecting a color space by name, you can specify
explicitly the contribution of each color channel to the overall
luminance as red, green, and blue multipliers. These three
options must be used together, and the three fraction values
must sum to 1.0. For example, you can specify the ProPhoto
(ROMM) RGB color space with <q>--rmult=0.2880402
--gmult=0.7118741 --bmult=0.0000857</q>.
--targetcolor=color
Designate color as the target color for the image. pamrecolor
will make each pixel as close as possible to color subject to
the constraint that the luminance must stay the same as in the
original image. Specify color as in the argument of the
ppm_parsecolor() library routine ⟨libppm.html#colorname⟩
(e.g., <q>hotpink</q> or <q>#ff69b4</q>).
If you specify neither --targetcolor nor --colorfile, pamrecolor
will randomly select a target color for each pixel of the input
image.
You may not specify both -targetcolor and -colorfile.
--colorfile=file
Take per-pixel target colors from Netpbm file file instead of
using a single target color for the entire image. file should
be a PPM or color PAM image. If the image in the file wider or
taller than the input image, pamrecolor uses only the left and
top part of it. If the image is narrower or shorter, pamrecolor
considers the image to be repeated in a tile pattern.
If you specify neither --targetcolor nor --colorfile, pamrecolor
will randomly select a target color for each pixel of the input
image.
You may not specify both -targetcolor and -colorfile.
EXAMPLES
This command tints an image yellow:
pamrecolor --targetcolor=yellow colorpic.pam > yellowpic.pam
This command takes the colors from colorpicture.ppm and applies them to
graypicture.pgm:
pamrecolor --colorfile=colorpic.ppm graypic.pgm > colorizedpic.pam
The grayscale version of colorizedpic.pam will look just like
graypic.pgm. Note that if you use a non-Netpbm tool to do the conver‐
sion to grayscale, you may additionally need to specify an appropriate
--colorspace value for your conversion tool.
NOTES
Here are a couple of fun special effects you can produce with pamre‐
color:
· Specify a color file that is identical to the input image but
with some large, colored text added to it. The text will
<q>magically</q> vanish when the image is converted to
grayscale.
· Provide a low-contrast grayscale image — perhaps a secret
message written in similar shades of gray — as the input
file and a colorful but completely different image as the color
file. If done carefully, the grayscale image can be hidden by
the colorful image. Only people who know to convert the result
to grayscale can recover the original grayscale image.
· Use --targetcolor=tan to make an image look like an old-timey
photograph (or, more precisely, a sepia-toned photograph
⟨http://en.wikipedia.org/wiki/Photographic_print_toning⟩ of the
late 1800s).
HISTORY
Scott Pakin wrote pamrecolor in July 2010.
pamrecolor was new in Netpbm 10.52 (September 2010).
AUTHOR
Copyright (C) 2010 Scott Pakin, scott+pbm@pakin.org.
SEE ALSO
·
ppmtopgm(1)
·
ppmchange(1)
·
pnmremap(1)netpbm documentation 31 July 2010 Pamrecolor User Manual(0)