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 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 In addition to the options common to all programs based on libnetpbm
76 (most notably -quiet, see
77 Common Options ⟨index.html#commonoptions⟩ ), pnmquant recognizes the
78 following command line options:
79
80
81 Options Passed to pnmcolormap
82 These options control the selection of the palette. They are options
83 to pnmcolormap(1).
84
85
86
87 -center
88
89 -meancolor
90
91 -meanpixel
92
93 -spreadbrightness
94
95 -spreadluminosity
96
97
98
99 Options Passed to pnmremap
100 These options control which color from the palette the program uses to
101 replace a pixel of a certain color from the input. They are options
102 to pnmremap(1).
103
104
105
106 -floyd
107
108 -fs
109
110 -nofloyd
111
112 -nofs
113
114 -norandom
115
116 -randomseed
117
118 -norandom
119
120
121
123 pnmquant did not exist before Netpbm 9.21 (January 2001). Before that,
124 ppmquant did the same thing, but only on PPM images. ppmquant contin‐
125 ues to exist, but is only a front end (for name compatibility) to
126 pnmquant.
127
128 -version did not exist before Netpbm 10.75 (June 2016).
129
130
131 -norandom did not exist before Netpbm 10.82 (March 2018).
132
133
135 pnmcolormap(1), pnmremap(1), ppmquantall(1), pamdepth(1), ppmdither(1),
136 ppmquant(1), pnm(1)
137
139 This manual page was generated by the Netpbm tool 'makeman' from HTML
140 source. The master documentation is at
141
142 http://netpbm.sourceforge.net/doc/pnmquant.html
143
144netpbm documentation 09 February 2019 Pnmquant User Manual(0)