\ .\" This man page was generated by the Netpbm tool 'makeman' from HTML source. .\" Do not hand-hack it! If you have bug fixes or improvements, please find .\" the corresponding HTML page on the Netpbm website, generate a patch .\" against that, and send it to the Netpbm maintainer. .TH "Pamrecolor User Manual" 1 "31 July 2010" "netpbm documentation" .SH NAME pamrecolor - alter colors without affecting luminance .UN synopsis .SH SYNOPSIS .PP \fBpamrecolor\fP [\fB--colorspace\fP=\fIname\fP] [\fB--rmult\fP=\fIfraction\fP] [\fB--gmult\fP=\fIfraction\fP] [\fB--bmult\fP=\fIfraction\fP] [\fB--targetcolor\fP=\fIcolor\fP] [\fB--colorfile\fP=\fIfile\fP] [\fB-randomseed=\fP\fIinteger\fP] [\fIinfile\fP] .PP Minimum unique abbreviation of option is acceptable. You may use double 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. .UN description .SH DESCRIPTION .PP This program is part of .BR "Netpbm" (1)\c \&. .PP \fBpamrecolor\fP 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 .BR "ppmtopgm" (1)\c \&). You can have \fBpamrecolor\fP select target colors randomly, specify a single hue for the entire image, or take the target colors from a target image. .PP In addition to real Netpbm images, \fBpamrecolor\fP works on pseudo-Netpbm images based on arbitrary color spaces. You can define the color space explicitly or choose one of many that \fBpamrecolor\fP knows by name. .PP 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 .BR "pamtopnm" (1)\c \& on the output. There is no 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. .UN options .SH OPTIONS .PP In addition to the options common to all programs based on libnetpbm (most notably \fB-quiet\fP, see .UR index.html#commonoptions Common Options .UE \&), \fBpamrecolor\fP recognizes the following command line options: .TP \fB--colorspace\fP=\fIname\fP Designate the color space to use for determining the contribution 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. .sp 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 different meaning. Many programs that ostensibly use Netpbm images actually use a variation with a different color space. For example, .UR http://www.gimp.org/ GIMP .UE \& uses sRGB internally and if you have GIMP generate a Netpbm image file, it really generates a variation of the format that uses sRGB. .sp \fBpamrecolor\fP knows the following color spaces (\fIname\fP values): .TP adobe Adobe RGB (1998) with a D65 reference white .TP apple Apple RGB with a D65 reference white .TP cie CIE with an Illuminant E reference white .TP ntsc NTSC RGB with an Illuminant C reference white .TP pal PAL/SECAM with a D65 reference white .TP smpte-c SMPTE-C with a D65 reference white .TP srgb sRGB with a D65 reference white .TP wide Wide-gamut RGB with a D50 reference white .sp The default is "ntsc" because this is the color space that the Netpbm formats and many graphics utilities use. As a counterexample, .UR http://www.gimp.org/ GIMP .UE \& uses sRGB as its native color space. .sp The luminance values \fBpamrecolor\fP uses for each of the above come from Bruce Lindbloom's .BR " Computing RGB-to-XYZ and XYZ-to-RGB matrices" (1)\c \& page. .TP \fB--rmult\fP=\fIfraction\fP .TP \fB--gmult\fP=\fIfraction\fP .TP \fB--bmult\fP=\fIfraction\fP 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 \fIfraction\fP values must sum to 1.0. For example, you can specify the ProPhoto (ROMM) RGB color space with "\fB--rmult\fP=0.2880402 \fB--gmult\fP=0.7118741 \fB--bmult\fP=0.0000857". .TP \fB--targetcolor\fP=\fIcolor\fP Designate \fIcolor\fP as the target color for the image. \fBpamrecolor\fP will make each pixel as close as possible to \fIcolor\fP subject to the constraint that the luminance must stay the same as in the original image. Specify \fIcolor\fP as in the .UR libnetpbm_image.html#colorname argument of the \fBpnm_parsecolor()\fP library routine .UE \& (e.g.,\ "hotpink" or "#ff69b4"). .sp If you specify neither \fB--targetcolor\fP nor \fB--colorfile\fP, \fBpamrecolor\fP will randomly select a target color for each pixel of the input image. .sp You may not specify both \fB-targetcolor\fP and \fB-colorfile\fP. .TP \fB--colorfile\fP=\fIfile\fP Take per-pixel target colors from Netpbm file \fIfile\fP instead of using a single target color for the entire image. \fIfile\fP should be a PPM or color PAM image. If the image in the file wider or taller than the input image, \fBpamrecolor\fP uses only the left and top part of it. If the image is narrower or shorter, \fBpamrecolor\fP considers the image to be repeated in a tile pattern. .sp If you specify neither \fB--targetcolor\fP nor \fB--colorfile\fP, \fBpamrecolor\fP will randomly select a target color for each pixel of the input image. .sp You may not specify both \fB-targetcolor\fP and \fB-colorfile\fP. .TP \fB-randomseed=\fP\fIinteger\fP This is the seed for the random number generator that generates the pixels. .sp Use this to ensure you get the same image on separate invocations. .sp By default, \fBpamrecolor\fP uses a seed derived from the time of day and process ID, which gives you fairly uncorrelated results in multiple invocations. .sp This option was new in Netpbm 10.61 (December 2012). .UN examples .SH EXAMPLES .PP This command tints an image yellow: .nf pamrecolor --targetcolor=yellow colorpic.pam > yellowpic.pam .fi .PP This command takes the colors from \fBcolorpicture.ppm\fP and applies them to \fBgraypicture.pgm\fP: .nf pamrecolor --colorfile=colorpic.ppm graypic.pgm > colorizedpic.pam .fi .PP The grayscale version of \fBcolorizedpic.pam\fP will look just like graypic.pgm. Note that if you use a non-Netpbm tool to do the conversion to grayscale, you may additionally need to specify an appropriate \fB--colorspace\fP value for your conversion tool. .UN notes .SH NOTES .PP Here are a couple of fun special effects you can produce with \fBpamrecolor\fP: .IP \(bu Specify a color file that is identical to the input image but with some large, colored text added to it. The text will "magically" vanish when the image is converted to grayscale. .IP \(bu 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. .IP \(bu Use \fB--targetcolor\fP=tan to make an image look like an old-timey photograph (or, more precisely, a .UR http://en.wikipedia.org/wiki/Photographic_print_toning sepia-toned photograph .UE \& of the late 1800s). .UN history .SH HISTORY .PP Scott Pakin wrote \fBpamrecolor\fP in July 2010. .PP \fBpamrecolor\fP was new in Netpbm 10.52 (September 2010). .UN author .SH AUTHOR .PP Copyright (C) 2010 Scott Pakin, \fIscott+pbm@pakin.org\fP .UN seealso .SH SEE ALSO .IP \(bu .BR "\fBppmtopgm\fP" (1)\c \& .IP \(bu .BR "\fBppmchange\fP" (1)\c \& .IP \(bu .BR "\fBpnmremap\fP" (1)\c \& .SH DOCUMENT SOURCE This manual page was generated by the Netpbm tool 'makeman' from HTML source. The master documentation is at .IP .B http://netpbm.sourceforge.net/doc/pamrecolor.html .PP