216 lines
5.0 KiB
HTML
216 lines
5.0 KiB
HTML
|
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
|
<HTML><HEAD><TITLE>Man page of pnmnorm</TITLE>
|
|
</HEAD><BODY>
|
|
<H1>pnmnorm</H1>
|
|
Section: User Commands (1)<BR>Updated: 7 October 1993<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>
|
|
|
|
pnmnorm - normalize the contrast in a Netbpm image
|
|
<A NAME="lbAC"> </A>
|
|
<H2>SYNOPSIS</H2>
|
|
|
|
<B>pnmnorm</B>
|
|
|
|
[<B>-bpercent</B>
|
|
|
|
<I>N</I>
|
|
|
|
|
|
|
<B>-bvalue</B>
|
|
|
|
<I>N</I>]
|
|
|
|
[<B>-wpercent</B>
|
|
|
|
<I>N</I>
|
|
|
|
|
|
|
<B>-wvalue</B>
|
|
|
|
<I>N</I>]
|
|
|
|
[<B>-keephues</B>]
|
|
|
|
[<B>-brightmax</B>]
|
|
|
|
<P>
|
|
[<I>ppmfile</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 (PBM, PGM, or PPM).
|
|
Normalizes the contrast by forcing the lightest pixels to white, the
|
|
<A NAME="ixAAC"></A>
|
|
darkest pixels to black, and linearly rescaling the ones in between;
|
|
and produces the same kind of file as output. This is pretty useless
|
|
for a PBM image.
|
|
<P>
|
|
|
|
The program first determines a mapping of old brightness to new brightness.
|
|
For each possible brightness of a pixel, the program determines a
|
|
corresponding brightness for the output image.
|
|
<P>
|
|
Then for each pixel in the image, the program computes a color which has
|
|
the desired output brightness and puts that in the output. With a color
|
|
image, it is not always possible to compute such a color and retain any
|
|
semblance of the original hue, so the brightest and dimmest pixels may only
|
|
approximate the desired brightness.
|
|
<P>
|
|
Note that for a PPM image, this is different from separately
|
|
normalizing the individual color components.
|
|
<P>
|
|
<A NAME="lbAE"> </A>
|
|
<H2>OPTIONS</H2>
|
|
|
|
<P>
|
|
|
|
By default, the darkest 2 percent of all pixels are mapped to black, and
|
|
the lightest 1 percent are mapped to white.
|
|
You can override these percentages by using the
|
|
<B>-bpercent</B>
|
|
|
|
and
|
|
<B>-wpercent</B>
|
|
|
|
flags,
|
|
or you can specify the exact pixel values to be mapped by using the
|
|
<B>-bvalue</B>
|
|
|
|
and
|
|
<B>-wvalue</B>
|
|
|
|
flags.
|
|
Appropriate numbers for the flags can be gotten from the
|
|
<I>ppmhist</I>
|
|
|
|
tool.
|
|
<A NAME="ixAAD"></A>
|
|
If you just want to enhance the contrast, then choose values at elbows in the
|
|
histogram; e.g. if value 29 represents 3% of the image but value 30
|
|
represents 20%, choose 30 for
|
|
<I>bvalue</I>.
|
|
|
|
If you want to lighten the
|
|
image, then set
|
|
<I>bvalue</I>
|
|
|
|
to 0 and just fiddle with
|
|
<I>wvalue</I>;
|
|
|
|
similarly, to darken the image, set
|
|
<I>wvalue</I>
|
|
|
|
to maxval and play with
|
|
<I>bvalue</I>.
|
|
|
|
<P>
|
|
The
|
|
<B>-keephues</B>
|
|
|
|
option says to keep each pixel the same hue as it is in the input; just
|
|
adjust its intensity. By default,
|
|
<B>pnmnorm</B>
|
|
|
|
normalizes contrast in each component independently (except that the
|
|
meaning of the
|
|
<B>-wpercent</B>
|
|
|
|
and
|
|
<B>-bpercent</B>
|
|
|
|
options are based on the overall intensities of the colors, not each
|
|
component taken separately). So if you have a color which is intensely
|
|
red but dimly green,
|
|
<B>pnmnorm</B>
|
|
|
|
would make the red more intense and the green less intense, so you end up
|
|
with a different hue than you started with.
|
|
<P>
|
|
If you specify
|
|
<B>-keephues</B>,
|
|
|
|
<B>pnmnorm</B>
|
|
|
|
would likely leave this pixel alone, since its overall intensity is medium.
|
|
<P>
|
|
<B>-keephues</B>
|
|
|
|
can cause clipping, because a certain color may be below a target
|
|
intensity while one of its components is saturated. Where that's the
|
|
case,
|
|
<B>pnmnorm</B>
|
|
|
|
uses the maximum representable intensity for the saturated component
|
|
and the pixel ends up with less overall intensity, and a different
|
|
hue, than it is supposed to have.
|
|
<P>
|
|
This option is meaningless on grayscale images.
|
|
<P>
|
|
Before March 2002, there was no
|
|
<B>-keephues</B>
|
|
|
|
option.
|
|
<P>
|
|
The
|
|
<B>-brightmax</B>
|
|
|
|
option says to use the intensity of the most intense RGB component of a pixel
|
|
as the pixel's brightness. By default,
|
|
<B>pnmnorm</B>
|
|
|
|
uses the luminosity of the color as its brightness.
|
|
<P>
|
|
This option is meaningless on grayscale images.
|
|
<P>
|
|
Before March 2002, there was no
|
|
<B>-brightmax</B>
|
|
|
|
option.
|
|
<P>
|
|
<P>
|
|
<A NAME="lbAF"> </A>
|
|
<H2>SEE ALSO</H2>
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?1+ppmhist">ppmhist</A></B>(1),
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?1+pgmhist">pgmhist</A></B>(1),
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?1+pnmgamma">pnmgamma</A></B>(1),
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?1+ppmbrighten">ppmbrighten</A></B>(1),
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?1+ppmdim">ppmdim</A></B>(1),
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?5+pnm">pnm</A></B>(5)
|
|
|
|
<P>
|
|
|
|
<HR>
|
|
<A NAME="index"> </A><H2>Index</H2>
|
|
<DL>
|
|
<DT id="1"><A HREF="#lbAB">NAME</A><DD>
|
|
<DT id="2"><A HREF="#lbAC">SYNOPSIS</A><DD>
|
|
<DT id="3"><A HREF="#lbAD">DESCRIPTION</A><DD>
|
|
<DT id="4"><A HREF="#lbAE">OPTIONS</A><DD>
|
|
<DT id="5"><A HREF="#lbAF">SEE ALSO</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>
|