| 1 |
\ |
| 2 |
.\" This man page was generated by the Netpbm tool 'makeman' from HTML source. |
| 3 |
.\" Do not hand-hack it! If you have bug fixes or improvements, please find |
| 4 |
.\" the corresponding HTML page on the Netpbm website, generate a patch |
| 5 |
.\" against that, and send it to the Netpbm maintainer. |
| 6 |
.TH "Pnmquant User Manual" 1 "09 February 2019" "netpbm documentation" |
| 7 |
|
| 8 |
.SH NAME |
| 9 |
pnmquant - quantize the colors in a Netpbm image to a smaller set |
| 10 |
|
| 11 |
.UN synopsis |
| 12 |
.SH SYNOPSIS |
| 13 |
|
| 14 |
\fBpnmquant\fP |
| 15 |
[\fB-center\fP|\fB-meancolor\fP|\fB-meanpixel\fP] |
| 16 |
[\fB-floyd\fP|\fB-fs\fP] |
| 17 |
[\fB-nofloyd\fP|\fB-nofs\fP] |
| 18 |
[\fB-spreadbrightness\fP|\fB-spreadluminosity\fP] |
| 19 |
{[\fB-norandom\fP]|[\fB-randomseed=\fP\fIn\fP]} |
| 20 |
\fIncolors\fP [\fIpnmfile\fP] |
| 21 |
.PP |
| 22 |
All options can be abbreviated to their shortest unique prefix. You |
| 23 |
may use two hyphens instead of one to designate an option. You may |
| 24 |
use either white space or equals signs between an option name and its |
| 25 |
value. |
| 26 |
|
| 27 |
|
| 28 |
.UN description |
| 29 |
.SH DESCRIPTION |
| 30 |
.PP |
| 31 |
This program is part of |
| 32 |
.BR "Netpbm" (1)\c |
| 33 |
\&. |
| 34 |
.PP |
| 35 |
\fBpnmquant\fP reads a PNM image as input. It chooses \fIncolors\fP |
| 36 |
colors to best represent the image, maps the existing colors |
| 37 |
to the new ones, and writes a PNM image as output. |
| 38 |
.PP |
| 39 |
This program is simply a combination of \fBpnmcolormap\fP and |
| 40 |
\fBpnmremap\fP, where the colors of the input are remapped using a |
| 41 |
color map which is generated from the colors in that same input. The |
| 42 |
options have the same meaning as in those programs. See their |
| 43 |
documentation to understand \fBpnmquant\fP. |
| 44 |
.PP |
| 45 |
You may actually get fewer than \fBncolors\fP colors in the output because |
| 46 |
the method \fBpnmcolormap\fP uses to choose the best set of colors for the |
| 47 |
image is not the same as the method \fBpnmremap\fP uses to determine the |
| 48 |
best color from the set to represent an individual color. For example, |
| 49 |
\fBpnmcolormap\fP may include salmon in the color map as the best |
| 50 |
representative of a pink pixel in the input and include coral in the color |
| 51 |
map as the best representative of an actual coral pixel in the input. But |
| 52 |
\fBpnmremap\fP is free to use any color in the color map to represent that |
| 53 |
pink pixel and would find coral is a closer match for pink than salmon and |
| 54 |
therefore use coral for pink. \fBpnmremap\fP might not use salmon |
| 55 |
for \fIany\fP pixel. |
| 56 |
.PP |
| 57 |
This waste of a slot in the color map is a consequence of the approximate |
| 58 |
method \fBpnmcolormap\fP uses in order to compute the color map with a |
| 59 |
practical amount of computation. |
| 60 |
|
| 61 |
|
| 62 |
.UN separate |
| 63 |
.SS Running \fBpnmcolormap\fP and \fBpnmremap\fP Separately |
| 64 |
|
| 65 |
.PP |
| 66 |
It is much faster to call \fBpnmcolormap\fP and \fBpnmremap\fP |
| 67 |
directly than to run \fBpnmquant\fP. You save the overhead of the |
| 68 |
Perl interpreter and creating two extra processes. \fBpnmquant\fP is |
| 69 |
just a convenience. |
| 70 |
.PP |
| 71 |
Here is an example of the relationship between the programs: |
| 72 |
.PP |
| 73 |
This: |
| 74 |
|
| 75 |
.nf |
| 76 |
\f(CW |
| 77 |
$ pnmquant 256 myimage.pnm >/tmp/colormap.pnm >myimage256.pnm |
| 78 |
\fP |
| 79 |
|
| 80 |
.fi |
| 81 |
.PP |
| 82 |
does essentially this: |
| 83 |
|
| 84 |
.nf |
| 85 |
\f(CW |
| 86 |
$ pnmcolormap 256 myimage.pnm >/tmp/colormap.pnm |
| 87 |
$ pnmremap -mapfile=/tmp/colormap.pnm myimage.pnm >myimage256.pnm |
| 88 |
\fP |
| 89 |
|
| 90 |
.fi |
| 91 |
|
| 92 |
.UN options |
| 93 |
.SH OPTIONS |
| 94 |
.PP |
| 95 |
In addition to the options common to all programs based on libnetpbm |
| 96 |
(most notably \fB-quiet\fP, see |
| 97 |
.UR index.html#commonoptions |
| 98 |
Common Options |
| 99 |
.UE |
| 100 |
\&), \fBpnmquant\fP recognizes the following |
| 101 |
command line options: |
| 102 |
|
| 103 |
.UN pnmcolormapopt |
| 104 |
.SS Options Passed to \fBpnmcolormap\fP |
| 105 |
|
| 106 |
|
| 107 |
.PP |
| 108 |
These options control the selection of the palette. They are options to |
| 109 |
.BR "\fBpnmcolormap\fP" (1)\c |
| 110 |
\&. |
| 111 |
|
| 112 |
|
| 113 |
.TP |
| 114 |
\fB-center\fP |
| 115 |
.TP |
| 116 |
\fB-meancolor\fP |
| 117 |
.TP |
| 118 |
\fB-meanpixel\fP |
| 119 |
.TP |
| 120 |
\fB-spreadbrightness\fP |
| 121 |
.TP |
| 122 |
\fB-spreadluminosity\fP |
| 123 |
|
| 124 |
|
| 125 |
.UN pnmremapopt |
| 126 |
.SS Options Passed to \fBpnmremap\fP |
| 127 |
|
| 128 |
|
| 129 |
.PP |
| 130 |
These options control which color from the palette the program uses to |
| 131 |
replace a pixel of a certain color from the input. They are options to |
| 132 |
.BR "\fBpnmremap\fP" (1)\c |
| 133 |
\&. |
| 134 |
|
| 135 |
|
| 136 |
.TP |
| 137 |
\fB-floyd\fP |
| 138 |
.TP |
| 139 |
\fB-fs\fP |
| 140 |
.TP |
| 141 |
\fB-nofloyd\fP |
| 142 |
.TP |
| 143 |
\fB-nofs\fP |
| 144 |
.TP |
| 145 |
\fB-norandom\fP |
| 146 |
.TP |
| 147 |
\fB-randomseed\fP |
| 148 |
.TP |
| 149 |
\fB-norandom\fP |
| 150 |
|
| 151 |
|
| 152 |
.UN history |
| 153 |
.SH HISTORY |
| 154 |
.PP |
| 155 |
\fBpnmquant\fP did not exist before Netpbm 9.21 (January 2001). |
| 156 |
Before that, \fBppmquant\fP did the same thing, but only on PPM |
| 157 |
images. \fBppmquant\fP continues to exist, but is only a front end |
| 158 |
(for name compatibility) to \fBpnmquant\fP. |
| 159 |
.PP |
| 160 |
\fB-version\fP did not exist before Netpbm 10.75 (June 2016). |
| 161 |
|
| 162 |
.PP |
| 163 |
\fB-norandom\fP did not exist before Netpbm 10.82 (March 2018). |
| 164 |
|
| 165 |
.UN seealso |
| 166 |
.SH SEE ALSO |
| 167 |
.BR "pnmcolormap" (1)\c |
| 168 |
\&, |
| 169 |
.BR "pnmremap" (1)\c |
| 170 |
\&, |
| 171 |
.BR "pnmquantall" (1)\c |
| 172 |
\&, |
| 173 |
.BR "pamdepth" (1)\c |
| 174 |
\&, |
| 175 |
.BR "ppmdither" (1)\c |
| 176 |
\&, |
| 177 |
.BR "ppmquant" (1)\c |
| 178 |
\&, |
| 179 |
.BR "pnm" (1)\c |
| 180 |
\& |
| 181 |
.SH DOCUMENT SOURCE |
| 182 |
This manual page was generated by the Netpbm tool 'makeman' from HTML |
| 183 |
source. The master documentation is at |
| 184 |
.IP |
| 185 |
.B http://netpbm.sourceforge.net/doc/pnmquant.html |
| 186 |
.PP |