Blob Blame History Raw
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML><HEAD><TITLE>Pnmhistmap User Manual</TITLE></HEAD>
<BODY>
<H1>pnmhistmap</H1>
Updated: 13 July 2009
<BR>
<A HREF="#index">Table Of Contents</A>

<H2>NAME</H2>

pnmhistmap - draw a histogram for a PGM or PPM file

<H2 id="synopsis">SYNOPSIS</H2>

<B>pnmhistmap</B>

[<B>-red</B>] [<B>-green</B>] [<B>-blue</B>]

[<B>-black</B>] [<B>-white</B>]

[<B>-max</B> <I>N</I>]

[<b>-lval</b>] [<b>-rval</b>]

[<b>-height</b>] [<b>-width</b>]

[<b>-dots</b>]

[<B>-verbose</B>]

[<I>pnmfile</I>]

<P>Minimum unique abbreviation of option is acceptable.  You may use
double hyphens instead of single hyphen to denote options.  You may use
white space in place of the equals sign to separate an option name
from its value.

<H2 id="description">DESCRIPTION</H2>

<p>This program is part of <a href="index.html">Netpbm</a>.

<p><b>pnmhistmap</b> reads a PNM image as input and produces an image
showing a histogram of the color (or gray) values in the input.  A PGM
input results in a PBM output.  A PPM input results in a PPM output
with three overlaid histograms: a red one for the red input, a green
one for the green input, and a blue one for the blue input.

<p>For example, from the following image produces the following histogram:

<p><img src="testimg.png" alt="image">
<img src="testimg_histbar.png" alt="histogram from image">

<p>If the input is PBM, <b>pnmhistmap</B> produces an error message
and no output image.

<H2 id="options">OPTIONS</H2>

<dl>

<dt><b>-red</b>
<dt><b>-green</b>
<dt><b>-blue</b>

<dd>Include the indicated color component in the output.  If you
specify none of these, <b>pnmhistmap</b> include all three.

<p>These options are meaningless if the input is PGM.

<p>These options were new in Netpbm 10.26 (January 2005).  Before
that, <b>pnmhistmap</b> always included all three color components.

<dt><b>-dots</b>

<dd>Plot the histogram as dots.  By default, <b>pnmhistmap</b> plots
bars.

<p>Example of dots: <img src="testimg_histdot.png" alt="-dots example">

<p>This option was new in Netpbm 10.26 (January 2005).  Before that,
<b>pnmhistmap</b> always plotted bars.

<dt><b>-lval</b> <i>minpixval</i>
<dt><b>-rval</b> <i>maxpixval</i>

<dd>These options specify the range of intensity values to include.
<b>pnmhistmap</b> ignores intensities less than <i>minpixval</i> and
greater than <i>maxpixval</i>.  So the left side of the histogram
corresponds to <i>minpixval</i> and the right side corresponds to
<i>maxpixval</i>.

<p>By default, <b>pnmhistmap</b> plots the entire possible range: zero
to the maxval.

<p>These options were new in Netpbm 10.26 (January 2005).  Before that,
<b>pnmhistmap</b> always plotted from zero to the maxval.

<dt>-height
<dt>-width

<dd>These options specify the dimensions, in pixels of the histogram image.

<p>The default height is 200 pixels.

<p>The default width is one pixel for each plotted intensity value (so it's 
controlled by the maxval of the image and the <b>-lval</b> and <b>-rval</b>
options).  The "count buckets" in the histogram are always
one pixel wide.  If you specify a width less than the number of plotted
intensity values, a bucket represents more than one intensity value.
If you specify a width greater that the number of plotted intensity values,
some buckets represent no color (the count is zero).

<p>This option was new in Netpbm 10.26 (January 2005).  Before that,
the dimensions were always what the default is today.

<DT><B>-black </B>

<DD>Ignore the count of black pixels when scaling the histogram.

<DT><B>-white</B>

<DD>Ignore the count of white pixels when scaling the histogram.

<P>The -black and -white options, which can be used separately or
together, are useful for images with a large percentage of pixels
whose value is zero or 255, which can cause the remaining histogram
data to become unreadably small.  Note that, for color inputs, these
options apply to all colors; if, for example, the input has a large
number of bright-red areas, you will probably want to use the -white
option.

<DT><B>-max N</B>

<DD>Force the scaling of the histogram to use N as the largest-count value.
This is useful for inputs with a large percentage of single-color pixels
which are not black or white.

<DT><B>-verbose</B>

<DD>Report the progress of making the histogram, including the largest-count
value used to scale the output.

</DL>


<H2 id="limitations">LIMITATIONS</H2>

<P><b>pnmhistmap</b> assumes maxval is always 255.  Images with a
smaller maxval will only use the lower-value side of the histogram.
You can overcome this either by piping the input through
<b>pamdepth</b> or by cutting and scaling the lower-value side of the
histogram.  Neither is a particularly elegant solution to the problem.

<H2 id="seealso">SEE ALSO</H2>

<A HREF="pgmhist.html">pgmhist</A>,
<A HREF="ppmhist.html">ppmhist</A>,
<A HREF="pgm.html">pgm</A>,
<A HREF="ppm.html">ppm</A>

<H2 id="author">AUTHOR</H2>

<p>Wilson H. Bent. Jr. (<A HREF="mailto:whb@usc.edu">whb@usc.edu</A>).

<HR>
<H2 id="index">Table Of Contents</H2>
<UL>
<LI><A HREF="#synopsis">SYNOPSIS</A>
<LI><A HREF="#description">DESCRIPTION</A>
<LI><A HREF="#options">OPTIONS</A>
<LI><A HREF="#limitations">LIMITATIONS</A>
<LI><A HREF="#seealso">SEE ALSO</A>
<LI><A HREF="#author">AUTHOR</A>
</UL>
</BODY>
</HTML>