ppmquant.1
2.25 KB
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
.TH ppmquant 1 "12 January 1991"
.IX ppmquant
.SH NAME
ppmquant - quantize the colors in a portable pixmap down to a specified number
.SH SYNOPSIS
.B ppmquant
.RB [ -floyd | -fs ]
.I ncolors
.RI [ ppmfile ]
.br
.B ppmquant
.RB [ -floyd | -fs ]
.B -map
.I mapfile
.RI [ ppmfile ]
.fi
.SH DESCRIPTION
Reads a portable pixmap as input.
Chooses
.I ncolors
colors to best represent the image, maps the existing colors
to the new ones, and writes a portable pixmap as output.
.IX "colormap reduction"
.PP
The quantization method is Heckbert's "median cut".
.IX "median cut"
.PP
Alternately, you can skip the color-choosing step by
specifying your own set of colors with the
.B -map
flag. The
.I mapfile
is just a
.I ppm
file; it can be any shape, all that matters is the colors in it.
For instance, to quantize down to the 8-color IBM TTL color set, you
might use:
.nf
P3
8 1
255
0 0 0
255 0 0
0 255 0
0 0 255
255 255 0
255 0 255
0 255 255
255 255 255
.fi
If you want to quantize one pixmap to use the colors in another one,
just use the second one as the mapfile.
You don't have to reduce it down to only one pixel of each color,
just use it as is.
.PP
The
.BR -floyd / -fs
flag enables a Floyd-Steinberg error diffusion step.
.IX Floyd-Steinberg
.IX "error diffusion"
Floyd-Steinberg gives vastly better results on images where the unmodified
quantization has banding or other artifacts, especially when going to a
small number of colors such as the above IBM set.
However, it does take substantially more CPU time, so the default is off.
.PP
All flags can be abbreviated to their shortest unique prefix.
.SH REFERENCES
"Color Image Quantization for Frame Buffer Display" by Paul Heckbert,
SIGGRAPH '82 Proceedings, page 297.
.SH "SEE ALSO"
ppmquantall(1), pnmdepth(1), ppmdither(1), ppm(5)
.SH AUTHOR
Copyright (C) 1989, 1991 by Jef Poskanzer.
.\" Permission to use, copy, modify, and distribute this software and its
.\" documentation for any purpose and without fee is hereby granted, provided
.\" that the above copyright notice appear in all copies and that both that
.\" copyright notice and this permission notice appear in supporting
.\" documentation. This software is provided "as is" without express or
.\" implied warranty.