PAMRECOLOR(1)
๐ NAME ๐
pamrecolor โ alter colors without affecting luminance โจ
okay so hi bestie, welcome to the pamrecolor manual page (she's part of the Pamrecolor User Manual, living in the General Commands Manual, section 1, iconic behavior only) ๐
๐ SYNOPSIS ๐
pamrecolor [--colorspace=name] [--rmult=fraction] [--gmult=fraction]
[--bmult=fraction] [--targetcolor=color] [--colorfile=file]
[-randomseed=integer]
[infile]
few little quality-of-life notes, no cap:
- 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 ๐ซถ
๐ 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 ppmtopgm(1)). You can have pamrecolor select target colors randomly, specify a single hue for the entire image, or take the target colors from a target image. literally obsessed with the flexibility here ๐
In addition to real Netpbm images, pamrecolor works on pseudo-Netpbm images based on arbitrary color spaces. You can define the color space explicitly or choose one 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) 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. ๐
โจ OPTIONS โจ
In addition to the options common to all programs based on libnetpbm (most notably -quiet, see Common Options), pamrecolor recognizes the following command line options:
--colorspace=nameโ 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 by0.2124132, the green channel by0.7010437, and the blue channel by0.0865432and 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 different meaning. Many programs that ostensibly use Netpbm images actually use a variation with a different color space. For example, GIMP 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 whiteappleโ Apple RGB with a D65 reference whitecieโ CIE with an Illuminant E reference whitentscโ NTSC RGB with an Illuminant C reference whitepalโ PAL/SECAM with a D65 reference whitesmpte-cโ SMPTE-C with a D65 reference whitesrgbโ sRGB with a D65 reference whitewideโ Wide-gamut RGB with a D50 reference white
The default is "ntsc" because this is the color space that the Netpbm formats and many graphics utilities use. As a counterexample, GIMP 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 to1.0. For example, you can specify the ProPhoto (ROMM) RGB color space with"--rmult=0.2880402 --gmult=0.7118741 --bmult=0.0000857". ๐งฎ--targetcolor=colorโ Designate color as the target color for the image.pamrecolorwill 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 thepnm_parsecolor()library routine (e.g.,"hotpink"or"#ff69b4"). ๐ฉท
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-targetcolorand-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,pamrecoloruses only the left and top part of it. If the image is narrower or shorter,pamrecolorconsiders 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-targetcolorand-colorfile.
-randomseed=integerโ This is the seed for the random number generator that generates the pixels. ๐ฒ
Use this to ensure you get the same image on separate invocations.
By default, pamrecolor uses a seed derived from the time of day and process ID, which gives you fairly uncorrelated results in multiple invocations.
This option was new in Netpbm 10.61 (December 2012). โญ
๐ธ 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 conversion 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 pamrecolor:
- 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. โจ
- 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=tanto make an image look like an old-timey photograph (or, more precisely, a sepia-toned photograph 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 ๐
๐ง DOCUMENT SOURCE ๐ง
This manual page was generated by the Netpbm tool makeman from HTML source. The master documentation is at
http://netpbm.sourceforge.net/doc/pamrecolor.html
and that's the whole page bestie!! this came to you from netpbm documentation, dated 31 July 2010 โ slay, periodt ๐ ๐โจ
๐ฆ where this page comes from
- debian trixie: netpbm 2:11.10.02-1 ยท MIT
- ubuntu resolute: netpbm 2:11.10.02-1build1 ยท MIT
- ubuntu stonking: netpbm 2:11.13.03+ds-2 ยท MIT
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms