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

FreeBSD Manual Pages


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

       pnmquant	- quantize the colors in a Netpbm image	to a smaller set

       pnmquant	 [-center|-meancolor|-meanpixel] [-floyd|-fs] [-nofloyd|-nofs]
       [-spreadbrightness|-spreadluminosity]	 {[-norandom]|[-randomseed=n]}
       [-quiet]	[-plain] ncolors [pnmfile]

       All  options  can  be abbreviated to their shortest unique prefix.  You
       may use two hyphens instead of one to designate an option.  You may use
       either  white  space  or	 equals	 signs	between	an option name and its

       This program is part of Netpbm(1).

       pnmquant	reads a	PNM image as input.  It	chooses	ncolors	colors to best
       represent  the  image,  maps  the  existing colors to the new ones, and
       writes a	PNM image as output.

       This program is simply a	combination of pnmcolormap and pnmremap, where
       the  colors of the input	are remapped using a color map which is	gener-
       ated from the colors in that same input.	 The  options  have  the  same
       meaning	as  in	those programs.	 See their documentation to understand

       You may actually	get fewer than ncolors colors in the output because
	 the method pnmcolormap	uses to	choose the best	set of colors for the
	 image is not the same as the method pnmremap uses to determine	the
	 best color from the set to represent an individual color.  For	 exam-
	 pnmcolormap may include salmon	in the color map as the	best
	 representative	 of a pink pixel in the	input and include coral	in the
	 map as	the best representative	of an actual coral pixel in the	input.
	 pnmremap is free to use any color in the color	map to represent that
	 pink  pixel  and  would  find	coral  is a closer match for pink than
       salmon and
	 therefore use coral for pink.	pnmremap might not use salmon
	 for any pixel.

       This waste of a slot in the color map is	a consequence of the  approxi-
	 method	pnmcolormap uses in order to compute the color map with	a
	 practical amount of computation.

   Running pnmcolormap and pnmremap Separately
       It is much faster to call pnmcolormap and pnmremap directly than	to run
       pnmquant.  You save the overhead	of the Perl interpreter	 and  creating
       two extra processes.  pnmquant is just a	convenience.

       Here is an example of the relationship between the programs:


	   $ pnmquant 256 myimage.pnm >/tmp/colormap.pnm >myimage256.pnm

       does essentially	this:

	   $ pnmcolormap 256 myimage.pnm >/tmp/colormap.pnm
	   $ pnmremap -mapfile=/tmp/colormap.pnm myimage.pnm >myimage256.pnm

       pnmquant	did not	exist before Netpbm 9.21 (January 2001).  Before that,
       ppmquant	did the	same thing, but	only on	PPM images.  ppmquant  contin-
       ues  to	exist, but is only a front end (for name compatibility)	to pn-

       -version	did not	exist before Netpbm 10.75 (June	2016).

       -norandom did not exist before Netpbm 10.82 (March 2018).

       pnmcolormap(1), pnmremap(1), ppmquantall(1), pamdepth(1), ppmdither(1),
       ppmquant(1), pnm(5)

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

netpbm documentation	       09 February 2019	       Pnmquant	User Manual(0)


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

home | help