1Pnmquant User Manual(0) Pnmquant User Manual(0)
2
3
4
6 pnmquant - quantize the colors in a Netpbm image to a smaller set
7
8
10 pnmquant [-center|-meancolor|-meanpixel] [-floyd|-fs] [-nofloyd|-nofs]
11 [-spreadbrightness|-spreadluminosity] {[-norandom]|[-randomseed=n]}
12 [-quiet] [-plain] ncolors [pnmfile]
13
14 All options can be abbreviated to their shortest unique prefix. You
15 may use two hyphens instead of one to designate an option. You may use
16 either white space or equals signs between an option name and its
17 value.
18
19
20
22 This program is part of Netpbm(1).
23
24 pnmquant reads a PNM image as input. It chooses ncolors colors to best
25 represent the image, maps the existing colors to the new ones, and
26 writes a PNM image as output.
27
28 This program is simply a combination of pnmcolormap and pnmremap, where
29 the colors of the input are remapped using a color map which is gener‐
30 ated from the colors in that same input. The options have the same
31 meaning as in those programs. See their documentation to understand
32 pnmquant.
33
34 You may actually get fewer than ncolors colors in the output because
35 the method pnmcolormap uses to choose the best set of colors for the
36 image is not the same as the method pnmremap uses to determine the
37 best color from the set to represent an individual color. For exam‐
38 ple,
39 pnmcolormap may include salmon in the color map as the best
40 representative of a pink pixel in the input and include coral in the
41 color
42 map as the best representative of an actual coral pixel in the input.
43 But
44 pnmremap is free to use any color in the color map to represent that
45 pink pixel and would find coral is a closer match for pink than
46 salmon and
47 therefore use coral for pink. pnmremap might not use salmon
48 for any pixel.
49
50 This waste of a slot in the color map is a consequence of the approxi‐
51 mate
52 method pnmcolormap uses in order to compute the color map with a
53 practical amount of computation.
54
55
56
57 Running pnmcolormap and pnmremap Separately
58 It is much faster to call pnmcolormap and pnmremap directly than to run
59 pnmquant. You save the overhead of the Perl interpreter and creating
60 two extra processes. pnmquant is just a convenience.
61
62 Here is an example of the relationship between the programs:
63
64 This:
65
66 $ pnmquant 256 myimage.pnm >/tmp/colormap.pnm >myimage256.pnm
67
68 does essentially this:
69
70 $ pnmcolormap 256 myimage.pnm >/tmp/colormap.pnm
71 $ pnmremap -mapfile=/tmp/colormap.pnm myimage.pnm >myimage256.pnm
72
73
75 pnmquant did not exist before Netpbm 9.21 (January 2001). Before that,
76 ppmquant did the same thing, but only on PPM images. ppmquant contin‐
77 ues to exist, but is only a front end (for name compatibility) to
78 pnmquant.
79
80 -version did not exist before Netpbm 10.75 (June 2016).
81
82
83 -norandom did not exist before Netpbm 10.82 (March 2018).
84
85
87 pnmcolormap(1), pnmremap(1), ppmquantall(1), pamdepth(1), ppmdither(1),
88 ppmquant(1), pnm(1)
89
91 This manual page was generated by the Netpbm tool 'makeman' from HTML
92 source. The master documentation is at
93
94 http://netpbm.sourceforge.net/doc/pnmquant.html
95
96netpbm documentation 09 February 2019 Pnmquant User Manual(0)