summaryrefslogtreecommitdiffstats
path: root/upstream/fedora-40/man1/pnmquant.1
blob: 165b1a7e5f9ed704de6bf20685533a97d3399458 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
\
.\" This man page was generated by the Netpbm tool 'makeman' from HTML source.
.\" Do not hand-hack it!  If you have bug fixes or improvements, please find
.\" the corresponding HTML page on the Netpbm website, generate a patch
.\" against that, and send it to the Netpbm maintainer.
.TH "Pnmquant User Manual" 0 "09 February 2019" "netpbm documentation"

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

.UN synopsis
.SH SYNOPSIS

\fBpnmquant\fP
[\fB-center\fP|\fB-meancolor\fP|\fB-meanpixel\fP]
[\fB-floyd\fP|\fB-fs\fP]
[\fB-nofloyd\fP|\fB-nofs\fP]
[\fB-spreadbrightness\fP|\fB-spreadluminosity\fP]
{[\fB-norandom\fP]|[\fB-randomseed=\fP\fIn\fP]}
\fIncolors\fP [\fIpnmfile\fP]
.PP
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
value.


.UN description
.SH DESCRIPTION
.PP
This program is part of
.BR "Netpbm" (1)\c
\&.
.PP
\fBpnmquant\fP reads a PNM image as input.  It chooses \fIncolors\fP
colors to best represent the image, maps the existing colors
to the new ones, and writes a PNM image as output.
.PP
This program is simply a combination of \fBpnmcolormap\fP and
\fBpnmremap\fP, where the colors of the input are remapped using a
color map which is generated from the colors in that same input.  The
options have the same meaning as in those programs.  See their
documentation to understand \fBpnmquant\fP.
.PP
You may actually get fewer than \fBncolors\fP colors in the output because
  the method \fBpnmcolormap\fP uses to choose the best set of colors for the
  image is not the same as the method \fBpnmremap\fP uses to determine the
  best color from the set to represent an individual color.  For example,
  \fBpnmcolormap\fP may include salmon in the color map as the best
  representative of a pink pixel in the input and include coral in the color
  map as the best representative of an actual coral pixel in the input.  But
  \fBpnmremap\fP 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.  \fBpnmremap\fP might not use salmon
  for \fIany\fP pixel.
.PP
This waste of a slot in the color map is a consequence of the approximate
  method \fBpnmcolormap\fP uses in order to compute the color map with a
  practical amount of computation.


.UN separate
.SS Running \fBpnmcolormap\fP and \fBpnmremap\fP Separately

.PP
It is much faster to call \fBpnmcolormap\fP and \fBpnmremap\fP
directly than to run \fBpnmquant\fP.  You save the overhead of the
Perl interpreter and creating two extra processes.  \fBpnmquant\fP is
just a convenience.
.PP
Here is an example of the relationship between the programs:
.PP
This:

.nf
\f(CW
    $ pnmquant 256 myimage.pnm >/tmp/colormap.pnm >myimage256.pnm
\fP

.fi
.PP
does essentially this:

.nf
\f(CW
    $ pnmcolormap 256 myimage.pnm >/tmp/colormap.pnm
    $ pnmremap -mapfile=/tmp/colormap.pnm myimage.pnm >myimage256.pnm
\fP

.fi

.UN options
.SH OPTIONS
.PP
In addition to the options common to all programs based on libnetpbm
(most notably \fB-quiet\fP, see 
.UR index.html#commonoptions
 Common Options
.UE
\&), \fBpnmquant\fP recognizes the following
command line options:

.UN pnmcolormapopt
.SS Options Passed to \fBpnmcolormap\fP

  
.PP
These options control the selection of the palette.  They are options to
.BR "\fBpnmcolormap\fP" (1)\c
\&.


.TP
\fB-center\fP
.TP
\fB-meancolor\fP
.TP
\fB-meanpixel\fP
.TP
\fB-spreadbrightness\fP
.TP
\fB-spreadluminosity\fP


.UN pnmremapopt
.SS Options Passed to \fBpnmremap\fP

  
.PP
These options control which color from the palette the program uses to
  replace a pixel of a certain color from the input.  They are options to
.BR "\fBpnmremap\fP" (1)\c
\&.


.TP
\fB-floyd\fP
.TP
\fB-fs\fP
.TP
\fB-nofloyd\fP
.TP
\fB-nofs\fP
.TP
\fB-norandom\fP
.TP
\fB-randomseed\fP
.TP
\fB-norandom\fP


.UN history
.SH HISTORY
.PP
\fBpnmquant\fP did not exist before Netpbm 9.21 (January 2001).
Before that, \fBppmquant\fP did the same thing, but only on PPM
images.  \fBppmquant\fP continues to exist, but is only a front end
(for name compatibility) to \fBpnmquant\fP.
.PP
\fB-version\fP did not exist before Netpbm 10.75 (June 2016).
  
.PP
\fB-norandom\fP did not exist before Netpbm 10.82 (March 2018).
  
.UN seealso
.SH SEE ALSO
.BR "pnmcolormap" (1)\c
\&,
.BR "pnmremap" (1)\c
\&,
.BR "pnmquantall" (1)\c
\&,
.BR "pamdepth" (1)\c
\&,
.BR "ppmdither" (1)\c
\&,
.BR "ppmquant" (1)\c
\&,
.BR "pnm" (1)\c
\&
.SH DOCUMENT SOURCE
This manual page was generated by the Netpbm tool 'makeman' from HTML
source.  The master documentation is at
.IP
.B http://netpbm.sourceforge.net/doc/pnmquant.html
.PP