246 lines
5.6 KiB
HTML
246 lines
5.6 KiB
HTML
|
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
|
<HTML><HEAD><TITLE>Man page of pnmremap</TITLE>
|
|
</HEAD><BODY>
|
|
<H1>pnmremap</H1>
|
|
Section: User Commands (1)<BR>Updated: 01 January 2002<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>
|
|
|
|
pnmremap - replace colors in a PPM image with colors from another set
|
|
<P>
|
|
<A NAME="lbAC"> </A>
|
|
<H2>SYNOPSIS</H2>
|
|
|
|
<B>pnmremap</B>
|
|
|
|
[<B>-floyd</B>|<B>-fs</B>|<B>-nfloyd</B>|<B>-nofs</B>]
|
|
|
|
[<B>-firstisdefault</B>]
|
|
|
|
[<B>-verbose</B>]
|
|
|
|
[<B>-mapfile=</B><I>mapfile</I>]
|
|
|
|
[<B>-missingcolor=</B><I>color</I>]
|
|
|
|
[<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>
|
|
|
|
<P>
|
|
<B>pnmremap</B>
|
|
|
|
replaces the colors in an input image with those from a colormap you
|
|
specify. Where a color in the input is not in the colormap, you have
|
|
three choices: 1) choose the closest color from the colormap;
|
|
2) choose the first color from the colormap; 3) use a color specified
|
|
by a command option. (In this latter case, if the color you specify is
|
|
not in your color map, the output will not necessarily contain only
|
|
colors from the colormap).
|
|
<P>
|
|
Two reasons to do this are: 1) you want to reduce the number of colors
|
|
in the input image; and 2) you need to feed the image to something that
|
|
can handle only certain colors.
|
|
<P>
|
|
To reduce colors, you can generate the colormap with
|
|
<B>ppmcolormap</B>.
|
|
|
|
Example:
|
|
<P>
|
|
<B>ppmcolormap testimg.ppm 256 >colormap.ppm</B>
|
|
|
|
<BR>
|
|
|
|
<B>ppmremap -map=colormap.ppm testimg.ppm </B>
|
|
|
|
<BR>
|
|
|
|
<B>>reduced_testimg.ppm</B>
|
|
|
|
<P>
|
|
To limit colors to a certain set, a typical example is to create an image
|
|
for posting on the World Wide Web, where different browsers know different
|
|
colors. But all browsers are supposed to know the 216 "web safe" colors
|
|
which are essentially all the colors you can represent in a PPM image with
|
|
a maxval of 5. So you can do this:
|
|
<P>
|
|
<B>ppmcolors 5 >websafe.ppm</B>
|
|
|
|
<BR>
|
|
|
|
<B>ppmremap -map=webafe.ppm testimg.ppm >websafe_testimg.ppm</B>
|
|
|
|
<P>
|
|
The output image has the same type and maxval as the map file.
|
|
<P>
|
|
<P>
|
|
<A NAME="lbAE"> </A>
|
|
<H2>PARAMETERS</H2>
|
|
|
|
<P>
|
|
There is one parameter, which is required: The file specifcation of the
|
|
input PNM file.
|
|
<P>
|
|
<P>
|
|
<B>OPTIONS</B>
|
|
|
|
<DL COMPACT>
|
|
<DT id="1"><B>-floyd</B>
|
|
|
|
<DD>
|
|
<B>-fs</B>
|
|
|
|
<B>-nofloyd</B>
|
|
|
|
<B>-nofs</B>
|
|
|
|
These options determine whether Floyd-Steinberg dithering is done.
|
|
Without Floyd-Steinberg, the selection of output color of a pixel is based
|
|
on the color of only the corresponding input pixel. With Floyd-Steinberg,
|
|
multiple input pixels are considered so that the average color of an area
|
|
tends to stay more the same than without Floyd-Steinberg. For example,
|
|
if you map an image with a black, gray, gray, and white pixel
|
|
adjacent, through a map that contains only black and white, it might
|
|
result in an output of black, black, white, white. Pixel-by-pixel
|
|
mapping would instead map both the gray pixels to the same color.
|
|
<P>
|
|
<B>-fs</B>
|
|
|
|
is a synomym for
|
|
<B>-floyd</B>.
|
|
|
|
<B>-nofs</B>
|
|
|
|
is a synonym for
|
|
<B>-nofloyd</B>.
|
|
|
|
<P>
|
|
The default is
|
|
<B>-nofloyd</B>.
|
|
|
|
<P>
|
|
<DT id="2"><B>-firstisdefault</B>
|
|
|
|
<DD>
|
|
This affects what happens with a pixel in the input image whose color is not
|
|
in the map file. If you specify neither
|
|
<B>-firstisdefault</B>
|
|
|
|
nor
|
|
<B>-missingcolor</B>,
|
|
|
|
<B>pnmremap</B>
|
|
|
|
chooses for the output the color in the map which is closest to the
|
|
color in the input. With
|
|
<B>-firstisdefault</B>,
|
|
|
|
<B>pnmremap</B>
|
|
|
|
instead uses the first color in the colormap.
|
|
<P>
|
|
If you specify
|
|
<B>-firstisdefault</B>,
|
|
|
|
the maxval of your input must match the maxval of your colormap.
|
|
<P>
|
|
<DT id="3"><B>-missingcolor=</B><I>color</I>
|
|
|
|
<DD>
|
|
This affects what happens with a pixel in the input image whose color is not
|
|
in the map file. If you specify neither
|
|
<B>-firstisdefault</B>
|
|
|
|
nor
|
|
<B>-missingcolor</B>,
|
|
|
|
<B>pnmremap</B>
|
|
|
|
chooses for the output the color in the map which is closest to the
|
|
color in the input.
|
|
With
|
|
<B>-missingcolor</B>,
|
|
|
|
<B>pnmremap </B>
|
|
|
|
uses
|
|
<I>color</I>.
|
|
|
|
<I>color</I>
|
|
|
|
need not be in the colormap.
|
|
<P>
|
|
If you specify
|
|
<B>-missingcolor</B>,
|
|
|
|
the maxval of your input must match the maxval of your colormap.
|
|
<P>
|
|
<DT id="4"><B>-verbose</B>
|
|
|
|
<DD>
|
|
Display helpful messages about the mapping process.
|
|
<P>
|
|
<P>
|
|
</DL>
|
|
<A NAME="lbAF"> </A>
|
|
<H2>SEE ALSO</H2>
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?1+pnmcolormap">pnmcolormap</A></B>(1),
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?1+ppmcolors">ppmcolors</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="lbAG"> </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="5"><A HREF="#lbAB">NAME</A><DD>
|
|
<DT id="6"><A HREF="#lbAC">SYNOPSIS</A><DD>
|
|
<DT id="7"><A HREF="#lbAD">DESCRIPTION</A><DD>
|
|
<DT id="8"><A HREF="#lbAE">PARAMETERS</A><DD>
|
|
<DT id="9"><A HREF="#lbAF">SEE ALSO</A><DD>
|
|
<DT id="10"><A HREF="#lbAG">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:24 GMT, March 31, 2021
|
|
</BODY>
|
|
</HTML>
|