185 lines
4.7 KiB
HTML
185 lines
4.7 KiB
HTML
|
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
|
<HTML><HEAD><TITLE>Man page of ppmchange</TITLE>
|
|
</HEAD><BODY>
|
|
<H1>ppmchange</H1>
|
|
Section: User Commands (1)<BR>Updated: 07 January 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>
|
|
|
|
ppmchange - change all pixels of one color to another in a portable pixmap
|
|
<A NAME="lbAC"> </A>
|
|
<H2>SYNOPSIS</H2>
|
|
|
|
<B>ppmchange</B>
|
|
|
|
[
|
|
<B>-closeness </B><I>closeness_percent</I>
|
|
|
|
]
|
|
[
|
|
<B>-remainder </B><I>remainder_color</I>
|
|
|
|
]
|
|
[
|
|
<I>oldcolor newcolor</I>
|
|
|
|
] ...
|
|
[<I>ppmfile</I>]
|
|
|
|
<P>
|
|
<A NAME="lbAD"> </A>
|
|
<H2>DESCRIPTION</H2>
|
|
|
|
Reads a portable pixmap as input. Changes all pixels of
|
|
<I>oldcolor </I>
|
|
|
|
to
|
|
<I>newcolor</I>.
|
|
|
|
You may specify up to 256 oldcolor/newcolor pairs on the command line.
|
|
<B>ppmchange</B>
|
|
|
|
leaves all colors not mentioned unchanged, unless you specify the
|
|
<B>-remainder</B>
|
|
|
|
option, in which case they are all changed to the single specified color.
|
|
<P>
|
|
You can specify that colors similar, but not identical, to the ones
|
|
you specify get replaced by specifying a "closeness" factor.
|
|
<P>
|
|
<P>
|
|
|
|
The colors can be specified in five ways:
|
|
<A NAME="ixAAC"></A>
|
|
<DL COMPACT>
|
|
<DT id="1">o<DD>
|
|
A name, assuming
|
|
that a pointer to an X11-style color names file was compiled in.
|
|
<DT id="2">o<DD>
|
|
An X11-style hexadecimal specifier: rgb:r/g/b, where r g and b are
|
|
each 1- to 4-digit hexadecimal numbers.
|
|
<DT id="3">o<DD>
|
|
An X11-style decimal specifier: rgbi:r/g/b, where r g and b are
|
|
floating point numbers between 0 and 1.
|
|
<DT id="4">o<DD>
|
|
For backwards compatibility, an old-X11-style hexadecimal
|
|
number: #rgb, #rrggbb, #rrrgggbbb, or #rrrrggggbbbb.
|
|
<DT id="5">o<DD>
|
|
For backwards compatibility, a triplet of numbers
|
|
separated by commas: r,g,b, where r g and b are
|
|
floating point numbers between 0 and 1.
|
|
(This style was added before MIT came up with the similar rgbi style.)
|
|
<P>
|
|
If a pixel matches two different
|
|
<I>oldcolor</I>s,
|
|
|
|
<B>ppmchange</B>
|
|
|
|
replaces it with the
|
|
<I>newcolor</I>
|
|
|
|
of the leftmost specified one.
|
|
<P>
|
|
<P>
|
|
</DL>
|
|
<A NAME="lbAE"> </A>
|
|
<H2>OPTIONS</H2>
|
|
|
|
<DL COMPACT>
|
|
<DT id="6"><B>-closeness </B><I>closeness_percent</I>
|
|
|
|
<DD>
|
|
<I>closeness</I>
|
|
|
|
is an integer per centage indicating how close to the color you specified
|
|
a pixel must be to get replaced. By default, it is 0, which means the
|
|
pixel must be the exact color you specified.
|
|
<P>
|
|
A pixel gets replaced if the distance in color between it and the color
|
|
you specified is less than or equal to
|
|
<I>closeness</I>.
|
|
|
|
<P>
|
|
The "distance" in color is defined as the cartesian sum of the
|
|
individual differences in red, green, and blue intensities between the
|
|
two pixels, normalized so that the difference between black and white
|
|
is 100%.
|
|
<P>
|
|
This is probably simpler than what you want most the time. You probably
|
|
would like to change colors that have similar chrominance, regardless
|
|
of their intensity. So if there's a red barn that is variously shadowed,
|
|
you want the entire barn changed. But because the shadowing significantly
|
|
changes the color according to
|
|
<B>ppmchange</B>'s
|
|
|
|
distance formula, parts of the barn are probably about as distant in
|
|
color from other parts of the barn as they are from green grass next to
|
|
the barn.
|
|
<P>
|
|
Maybe
|
|
<B>ppmchange</B>
|
|
|
|
will be enhanced some day to do chrominance analysis.
|
|
<P>
|
|
<DT id="7"><B>-remainder </B><I>color</I>
|
|
|
|
<DD>
|
|
<B>ppmchange</B>
|
|
|
|
changes all pixels which are not of a color for which you specify an
|
|
explicit replacement color on the command line to color
|
|
<I>color</I>.
|
|
|
|
<P>
|
|
An example application of this is
|
|
<P>
|
|
<B>ppmchange -remainder=black red red</B>
|
|
|
|
<P>
|
|
to lift only the red portions from an image, or
|
|
<P>
|
|
<B>ppmchange -remainder=black red white | ppmtopgm</B>
|
|
|
|
<P>
|
|
to create a mask file for the red portions of the image.
|
|
<P>
|
|
</DL>
|
|
<A NAME="lbAF"> </A>
|
|
<H2>SEE ALSO</H2>
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?1+pgmtoppm">pgmtoppm</A></B>(1),
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?1+ppmcolormask">ppmcolormask</A></B>(1),
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?5+ppm">ppm</A></B>(5)
|
|
|
|
<P>
|
|
<A NAME="lbAG"> </A>
|
|
<H2>AUTHOR</H2>
|
|
|
|
Wilson H. Bent. Jr. (<A HREF="mailto:whb@usc.edu">whb@usc.edu</A>)
|
|
with modifications by Alberto Accomazzi (<A HREF="mailto:alberto@cfa.harvard.edu">alberto@cfa.harvard.edu</A>)
|
|
<P>
|
|
|
|
<HR>
|
|
<A NAME="index"> </A><H2>Index</H2>
|
|
<DL>
|
|
<DT id="8"><A HREF="#lbAB">NAME</A><DD>
|
|
<DT id="9"><A HREF="#lbAC">SYNOPSIS</A><DD>
|
|
<DT id="10"><A HREF="#lbAD">DESCRIPTION</A><DD>
|
|
<DT id="11"><A HREF="#lbAE">OPTIONS</A><DD>
|
|
<DT id="12"><A HREF="#lbAF">SEE ALSO</A><DD>
|
|
<DT id="13"><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>
|