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