267 lines
6.8 KiB
HTML
267 lines
6.8 KiB
HTML
|
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
|
<HTML><HEAD><TITLE>Man page of pnmcolormap</TITLE>
|
|
</HEAD><BODY>
|
|
<H1>pnmcolormap</H1>
|
|
Section: User Commands (1)<BR>Updated: 12 December 2001<BR><A HREF="#index">Index</A>
|
|
<A HREF="/cgi-bin/man/man2html">Return to Main Contents</A><HR>
|
|
|
|
<A NAME="ixAAB"></A>
|
|
<A NAME="lbAB"> </A>
|
|
<H2>NAME</H2>
|
|
|
|
pnmcolormap - create quantization color map for a portable anymap
|
|
<P>
|
|
<A NAME="lbAC"> </A>
|
|
<H2>SYNOPSIS</H2>
|
|
|
|
<B>pnmcolormap</B>
|
|
|
|
[<B>-center</B>|<B>-meancolor</B>|<B>-meanpixel</B>]
|
|
|
|
[<B>-spreadbrightness</B>|<B>-spreadluminosity</B>]
|
|
|
|
[<B>-sort</B>]
|
|
|
|
[<B>-square</B>]
|
|
|
|
<I>ncolors</I>|<I></I><B>all</B>
|
|
|
|
[<I>pnmfile</I>]
|
|
|
|
<P>
|
|
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 an equals sign between an option name and
|
|
its value.
|
|
<P>
|
|
<A NAME="lbAD"> </A>
|
|
<H2>DESCRIPTION</H2>
|
|
|
|
Reads a PNM image as input. Chooses
|
|
<I>ncolors</I>
|
|
|
|
colors to best represent the image, maps the existing colors
|
|
to the new ones, and writes a PNM color map defining them as output.
|
|
<A NAME="ixAAC"></A>
|
|
<P>
|
|
You can use this map as input to
|
|
<B>pnmremap</B>
|
|
|
|
on the same input image to quantize the colors in that image, I.e.
|
|
produce a similar image with fewer colors.
|
|
<B>pnmquant</B>
|
|
|
|
does both the
|
|
<B>pnmcolormap</B>
|
|
|
|
and
|
|
<B>pnmremap</B>
|
|
|
|
steps for you.
|
|
<P>
|
|
A PNM colormap is a PNM image of any dimensions that contains at least one
|
|
pixel of each color in the set of colors it represents.
|
|
<P>
|
|
The quantization method is Heckbert's "median cut".
|
|
<A NAME="ixAAD"></A>
|
|
See the section QUANTIZATION METHOD.
|
|
<P>
|
|
If the input image is a PPM, the output image is a PPM. If the input
|
|
image is a PBM or PGM, the output colormap is a PGM. Note that a colormap
|
|
of a PBM image is not very interesting.
|
|
<P>
|
|
The colormap generally has the same maxval as the input image, but
|
|
<B>pnmcolormap</B>
|
|
|
|
may reduce it if there are too many colors in the input, as part of its
|
|
quantization algorithm.
|
|
<P>
|
|
If you want to create a colormap without basing it on the colors in an
|
|
input image, see
|
|
<B>ppmcolors</B>.
|
|
|
|
<P>
|
|
<A NAME="lbAE"> </A>
|
|
<H2>PARAMETERS</H2>
|
|
|
|
<P>
|
|
The single parameter, which is required, is the number of colors you want
|
|
in the output colormap.
|
|
<B>pnmcolormap</B>
|
|
|
|
may produce a color map with slightly fewer colors than that. You may
|
|
specify
|
|
<B>all</B>
|
|
|
|
to get a colormap of every color in the input image (no quantization).
|
|
<P>
|
|
<P>
|
|
<B>OPTIONS</B>
|
|
|
|
<DL COMPACT>
|
|
<DT id="1"><B>-sort</B>
|
|
|
|
<DD>
|
|
This option causes the output colormap to be sorted by the red component
|
|
intensity, then the green, then the blue in ascending order. This is an
|
|
insertion sort, so it is not very fast on large colormaps. Sorting is
|
|
useful because it allows you to compare two sets of colors.
|
|
<DT id="2"><B>-square</B>
|
|
|
|
<DD>
|
|
By default,
|
|
<B>pnmcolormap</B>
|
|
|
|
produces as the color map a PPM image with one row and one column for each
|
|
color in the colormap. This option causes
|
|
<B>pnmcolormap</B>
|
|
|
|
instead to produce a PPM image that is within one row or column of being
|
|
square, with multiple pixels of the same color as necessary to create a
|
|
number of pixels which is a perfect square.
|
|
<DT id="3"><B>-verbose</B>
|
|
|
|
<DD>
|
|
This option causes
|
|
<B>pnmcolormap</B>
|
|
|
|
to display messages to Standard Error about the quantization.
|
|
<DT id="4"><B>-center</B>
|
|
|
|
<DD>
|
|
<DT id="5"><B>-meancolor</B>
|
|
|
|
<DD>
|
|
<DT id="6"><B>-meanpixel</B>
|
|
|
|
<DD>
|
|
<DT id="7"><B>-spreadbrightness</B>
|
|
|
|
<DD>
|
|
<DT id="8"><B>-spreadluminosity</B>
|
|
|
|
<DD>
|
|
These options control the quantization algorithm. See
|
|
QUANTIZATION METHOD below.
|
|
<P>
|
|
<P>
|
|
</DL>
|
|
<A NAME="lbAF"> </A>
|
|
<H2>QUANTIZATION METHOD</H2>
|
|
|
|
<P>
|
|
A quantization method is a way to choose which colors, being fewer in
|
|
number than in the input, you want in the output.
|
|
<B>pnmcolormap</B>
|
|
|
|
uses Heckbert's "median cut" quantization method.
|
|
<P>
|
|
This method involves separating all the colors into "boxes," each
|
|
holding colors that represent about the same number of pixels. You
|
|
start with one box and split boxes in two until the number of boxes is
|
|
the same as the number of colors you want in the output, and choose
|
|
one color to represent each box.
|
|
<P>
|
|
When you split a box, you do it so that all the colors in one sub-box
|
|
are "greater" than all the colors in the other. "Greater," for a
|
|
particular box, means it is brighter in the color component
|
|
(red, green, blue) which has the largest spread in that box.
|
|
<B>pnmcolormap</B>
|
|
|
|
gives you two ways to define "largest spread.": 1) largest spread of
|
|
brightness; 2) largest spread of contribution to the luminosity of the
|
|
color. E.g. red is weighted much more than blue. Select among these
|
|
with the
|
|
<B>-spreadbrightness</B>
|
|
|
|
and
|
|
<B>-spreadluminosity</B>
|
|
|
|
options. The default is
|
|
<B>-spreadbrightness</B>.
|
|
|
|
<P>
|
|
<B>pnmcut</B>
|
|
|
|
provides three ways of choosing a color to represent a box: 1) the
|
|
center color - the color halfway between the greatest and least colors
|
|
in the box, using the above definition of "greater"; 2) the mean of
|
|
the colors (each component averaged separately by brightness) in the
|
|
box; 3) the mean weighted by the number of pixels of a color in the
|
|
image.
|
|
<P>
|
|
Note that in all three methods, there may be colors in the output which
|
|
do not appear in the input at all.
|
|
<P>
|
|
Select among these with the
|
|
<B>-center</B>,
|
|
|
|
<B>-meancolor</B>,
|
|
|
|
and
|
|
<B>-meanpixel</B>
|
|
|
|
options. The default is
|
|
<B>-center</B>.
|
|
|
|
<P>
|
|
<P>
|
|
<P>
|
|
<A NAME="lbAG"> </A>
|
|
<H2>REFERENCES</H2>
|
|
|
|
"Color Image Quantization for Frame Buffer Display" by Paul Heckbert,
|
|
SIGGRAPH '82 Proceedings, page 297.
|
|
<P>
|
|
<A NAME="lbAH"> </A>
|
|
<H2>SEE ALSO</H2>
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?1+pnmremap">pnmremap</A></B>(1),
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?1+pnmquant">pnmquant</A></B>(1),
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?1+ppmquantall">ppmquantall</A></B>(1),
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?1+pnmdepth">pnmdepth</A></B>(1),
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?1+ppmdither">ppmdither</A></B>(1),
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?1+ppmquant">ppmquant</A></B>(1),
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?5+ppm">ppm</A></B>(5)
|
|
|
|
<P>
|
|
<A NAME="lbAI"> </A>
|
|
<H2>AUTHOR</H2>
|
|
|
|
Copyright (C) 1989, 1991 by Jef Poskanzer.
|
|
Copyright (C) 2001 by Bryan Henderson.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<P>
|
|
|
|
<HR>
|
|
<A NAME="index"> </A><H2>Index</H2>
|
|
<DL>
|
|
<DT id="9"><A HREF="#lbAB">NAME</A><DD>
|
|
<DT id="10"><A HREF="#lbAC">SYNOPSIS</A><DD>
|
|
<DT id="11"><A HREF="#lbAD">DESCRIPTION</A><DD>
|
|
<DT id="12"><A HREF="#lbAE">PARAMETERS</A><DD>
|
|
<DT id="13"><A HREF="#lbAF">QUANTIZATION METHOD</A><DD>
|
|
<DT id="14"><A HREF="#lbAG">REFERENCES</A><DD>
|
|
<DT id="15"><A HREF="#lbAH">SEE ALSO</A><DD>
|
|
<DT id="16"><A HREF="#lbAI">AUTHOR</A><DD>
|
|
</DL>
|
|
<HR>
|
|
This document was created by
|
|
<A HREF="/cgi-bin/man/man2html">man2html</A>,
|
|
using the manual pages.<BR>
|
|
Time: 00:05:23 GMT, March 31, 2021
|
|
</BODY>
|
|
</HTML>
|