Skip site navigation (1)Skip section navigation (2)

FreeBSD Manual Pages


home | help
Pamrecolor User	Manual(0)			     Pamrecolor	User Manual(0)

       Table Of	Contents <#contents>

       pamrecolor - alter colors without affecting luminance

       pamrecolor  [--colorspace=name]	[--rmult=fraction]  [--gmult=fraction]
       [--bmult=fraction] [--targetcolor=color]	 [--colorfile=file]  [-random-


       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.

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

       pamrecolor works	on pseudo-Netpbm images	based on arbitrary color  spa-
       ces.   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  ex-
       act 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.

	      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  ex-
	      ample,  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 RGB	(1998) with a D65 reference white


	      Apple  RGB with a	D65 reference white


	      CIE with an Illuminant E reference white


	      NTSC RGB with an Illuminant C reference white


	      PAL/SECAM	with a D65 reference white


	      SMPTE-C with a D65 reference white


	      sRGB with	a D65 reference	white


	      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 counterex-
	      ample,  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 ma-
	      trices" (1) page.



	      Instead of selecting a color space by name, you can specify  ex-
	      plicitly	the  contribution of each color	channel	to the overall
	      luminance	as red,	green, and blue	multipliers.  These three  op-
	      tions  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	 "--rmult=0.2880402  --gmult=0.7118741

	      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
	      pnm_parsecolor()		       library		       routine
	      <libnetpbm_image.html#colorname>		(e.g., "hotpink"    or

	      If you specify neither --targetcolor nor --colorfile, pamrecolor
	      will  randomly select a target color for each pixel of the input

	      You may not specify both -targetcolor and	-colorfile.

	      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

	      You may not specify both -targetcolor and	-colorfile.

	      This  is the seed	for the	random number generator	that generates
	      the pixels.

	      Use this to ensure you get the same image	 on  separate  invoca-

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

       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

	   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.

       Here  are  a  couple of fun special effects you can produce with	pamre-

       o      Specify a	color file that	is identical to	the  input  image  but
	      with some	large, colored text added to it.  The text will	"magi-
	      cally" vanish when the image is converted	to grayscale.

       o      Provide a	low-contrast grayscale image - perhaps a  secret  mes-
	      sage 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	color-
	      ful image.  Only people  who  know  to  convert  the  result  to
	      grayscale	can recover the	original grayscale image.

       o      Use  --targetcolor=tan  to  make an image	look like an old-timey
	      photograph  (or,	more  precisely,  a   sepia-toned   photograph
	      <>	of the
	      late 1800s).

       Scott Pakin wrote pamrecolor in July 2010.

       pamrecolor was new in Netpbm 10.52 (September 2010).

       Copyright (C) 2010 Scott	Pakin,







       This manual page	was generated by the Netpbm tool 'makeman'  from  HTML
       source.	The master documentation is at

netpbm documentation		 31 July 2010	     Pamrecolor	User Manual(0)


Want to link to this manual page? Use this URL:

home | help