.TL
Ppmhist User Manual
.SH 1
ppmhist
.LP
Updated: 24 June 2005
.br
Table Of Contents
.SH 2
NAME
.LP
ppmhist - print a histogram of the colors in a PPM image
.SH 2
SYNOPSIS
.LP
\fBppmhist\fR
[\fB-hexcolor\fR | \fB-float\fR | \fB-colorname\fR | \fB-map\fR]
[\fB-nomap\fR]
[\fB-noheader\fR]
[\fB-sort=\fR{\fBfrequency\fR,\fBrgb\fR}]
[\fIppmfile\fR]
.SH 2
DESCRIPTION
.LP
.LP
This program is part of Netpbm.
.LP
\fBppmhist\fRreads a PPM image as input and generates a histogram
of the colors in the image, i.e. a list of all the colors and how many
pixels of each color are in the image.
.SH 3
Output Format
.LP
.LP
The output is in one of two basic formats: a report for humans
and a PPM image for use by programs. The PPM image is actually quite
readable by humans too.
.SH 4
Human Report
.LP
.LP
You get this format by specifying (or defaulting to) the
\fB-nomap\fR option.
.LP
The format is one line for each color in the input image.
.LP
By default, there are two lines of column header at the top. Use the
\fB-noheader\fR option to suppress those lines.
.LP
In each line, \fBppmhist\fR identifies the color by red, green,
and blue components. By default, it lists each of these in decimal,
using the exact values that are in the PPM input. So if the image has
a maxval of 255, the numbers in the listing range from 0 to 255. With
the \fB-hexcolor\fR option, you can change these numbers to
hexadecimal. With the \fB-float\fR option, the numbers are
fractional, adjusted to a maxval of 1.
.LP
Each line lists the luminosity of the color. It is in decimal
on the same scale as the rgb values (see above).
.LP
Each line lists the number of pixels in the image that have the color.
This is in decimal.
.SH 4
PPM Output
.LP
.LP
You get this format with the \fB-map\fR option.
.LP
The output file is a genuine PPM image, but it is PPM Plain format
and contains comments so that it is not a lot different from the
human report described above.
.LP
As a PPM image, it can be useful as input to other programs that
need some kind of palette. The image is a single row with one
column for each distinct color in the image.
.SH 2
OPTIONS
.LP
.RS
.IP "\fB-sort=\fR{\fBfrequency\fR,\fBrgb\fR}"
The \fB-sort\fR option determines the order in which the colors
are listed in the output. \fBfrequency\fR means to list them in
order of how pixels in the input image have the color, with the most
represented colors first. \fBrgb\fR means to sort them first by the
intensity of the red component of the color, then of the green, then of
the blue, with the least intense first.
.LP
The default is \fBfrequency\fR.
.IP "\fB-hexcolor\fR"
Print the color components in hexadecimal. See output format.
.LP
You may not specify this option along with \fB-float\fR or \fBmap\fR.
.IP "\fB-float\fR"
Print the color components and the luminosity as floating point
numbers in the range [0,1]. See output format.
.LP
You may not specify this option along with \fB-hexcolor\fR or \fBmap\fR.
.LP
This option was added in Netpbm 10.19 (November 2003).
.IP "\fB-map\fR"
Generates a PPM file of the colormap for the image, with the
color histogram as comments. See output format.
.LP
You may not specify this option along with \fB-float\fR or \fBhexcolor\fR.
.IP "\fB-nomap\fR"
Generates the histogram for human reading. This is the default.
.IP "\fB-colorname\fR"
Add the color name to the output. This is the name from the system color dictionary. If the exact
color is not in the color dictionary, it is the closest color that is
in the dictionary and is preceded by a '*'. If you don't have a
system color dictionary, the program fails.
.LP
This option was added in Netpbm 10.10 (October 2002).
.IP "\fB-noheader\fR"
Do not print the column headings.
.RE
.SH 2
SEE ALSO
.LP
\fBppm\fR,
\fBpgmhist\fR,
\fBpnmcolormmap\fR,
\fBpnmhistmap\fR,
\fBppmchange\fR
.LP
.SH 2
AUTHOR
.LP
Copyright (C) 1989 by Jef Poskanzer.
.br
\l'5i'
.SH 2
Table Of Contents
.LP
.IP \(bu
NAME
.IP \(bu
SYNOPSIS
.IP \(bu
DESCRIPTION
.IP \(bu
OPTIONS
.IP \(bu
SEE ALSO
.IP \(bu
AUTHOR
.LP
|