1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218
|
\
.\" This man page was generated by the Netpbm tool 'makeman' from HTML source.
.\" Do not hand-hack it! If you have bug fixes or improvements, please find
.\" the corresponding HTML page on the Netpbm website, generate a patch
.\" against that, and send it to the Netpbm maintainer.
.TH "Ppmhist User Manual" 1 "24 August 2019" "netpbm documentation"
.SH NAME
ppmhist - print a histogram of the colors in a PPM image
.UN synopsis
.SH SYNOPSIS
\fBppmhist\fP
[\fB-map\fP | \fB-nomap\fP]
[\fB-hexcolor\fP | \fB-float\fP | \fB-colorname\fP]
[\fB-noheader\fP]
[\fB-sort=\fP{\fBfrequency\fP,\fBrgb\fP}]
[\fB-forensic\fP]
[\fIppmfile\fP]
.UN description
.SH DESCRIPTION
.PP
This program is part of
.BR "Netpbm" (1)\c
\&.
.PP
\fBppmhist\fP reads 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.
.UN output
.SS Output Format
.PP
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.
.B Human Report
.PP
You get this format by specifying (or defaulting to) the
\fB-nomap\fP option.
.PP
The format is one line for each color in the input image.
.PP
By default, there are two lines of column header and a summary at the top.
Use the \fB-noheader\fP option to suppress those lines.
.PP
The summary tells you whether black or white are present and how many
shades of gray and color are present. The summary was new in Netpbm 10.82
(March 2018).
.PP
In each line, \fBppmhist\fP 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\fP option, you can change these numbers to
hexadecimal. With the \fB-float\fP option, the numbers are
fractional, adjusted to a maxval of 1.
.PP
Each line lists the luminosity of the color. It is in decimal
on the same scale as the rgb values (see above).
.PP
Each line lists the number of pixels in the image that have the color.
This is in decimal.
.B PPM Output
.PP
You get this format with the \fB-map\fP option.
.PP
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.
.PP
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.
.PP
The function of PPM output is essentially the same as the output of
\fBpnmcolormap all\fP. \fBppmhist\fP is much older than \fBpnmcolormap\fP.
.UN options
.SH OPTIONS
.PP
In addition to the options common to all programs based on libnetpbm
(most notably \fB-quiet\fP, see
.UR index.html#commonoptions
Common Options
.UE
\&), \fBppmhist\fP recognizes the following
command line options:
.TP
\fB-sort=\fP{\fBfrequency\fP,\fBrgb\fP}
The \fB-sort\fP option determines the order in which the colors are
listed in the output. \fBrgb\fP 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. \fBfrequency\fP means to list them in order of how many
pixels in the input image have the color, with the most represented colors
first. Among colors with the same frequency, the order is the same as with
\fBrgb\fP.
.sp
The default is \fBfrequency\fP.
.sp
Before Netpbm 10.88 (September 2019), with \fB-sort=frequency\fP, the
order of colors that have the same frequency is arbitrary.
.TP
\fB-hexcolor\fP
Print the color components in hexadecimal. See
.UR #output
output format
.UE
\&.
.sp
You may not specify this option along with \fB-float\fP or \fBmap\fP.
.TP
\fB-float\fP
Print the color components and the luminosity as floating point
numbers in the range [0,1]. See
.UR #output
output format
.UE
\&.
.sp
You may not specify this option along with \fB-hexcolor\fP or \fBmap\fP.
.sp
This option was added in Netpbm 10.19 (November 2003).
.TP
\fB-map\fP
Generates a PPM file of the colormap for the image, with the
color histogram as comments. See
.UR #output
output format
.UE
\&.
.sp
You may not specify this option along with \fB-float\fP or \fBhexcolor\fP.
.TP
\fB-nomap\fP
Generates the histogram for human reading. This is the default.
.TP
\fB-colorname\fP
Add the color name to the output. This is the name from
the
.UR libppm.html#dictionary
system color dictionary
.UE
\&. If the
exact color is not in the color dictionary, it is an asterisk followed by the
name of the closest color that is in the dictionary. If you don't have a
system color dictionary, the program fails.
.sp
This option was added in Netpbm 10.10 (October 2002).
.TP
\fB-noheader\fP
Do not print the column headings.
.TP
\fB-forensic\fP
.sp
With this option, \fBppmhist\fP works on images that contain invalid sample
values. Normally, like most Netpbm programs, \fBppmhist\fP fails if it
encounters a sample value greater than the maxval that the image declares. The
presence of such a value means the image is invalid, so the pixels have no
meaning. But with \fB-forensic\fP, \fBppmhist\fP produces a histogram
of the actual sample values without regard to maxval. It issues messages
summarizing the invalid pixels if there are any.
.sp
One use for this is to diagnose the problem that caused the invalid Netpbm
image to exist.
.sp
There is a small exception to the ability of \fBppmhist\fP to process
invalid pixels even with \fB-forensic\fP: it can never process a sample value
greater than 65535. Note that in the rarely used Plain PPM format, it is
possible for a number greater than that to appear where a sample value
belongs.
.sp
This option was new in Netpbm 10.66 (March 2014). But Netpbm older than
10.66 does not properly reject invalid sample values, so the effect is very
similar to \fB-forensic\fP.
.UN seealso
.SH SEE ALSO
.BR "ppm" (1)\c
\&,
.BR "pgmhist" (1)\c
\&,
.BR "pnmcolormap" (1)\c
\&,
.BR "pnmhistmap" (1)\c
\&,
.BR "ppmchange" (1)\c
\&
.UN author
.SH AUTHOR
Copyright (C) 1989 by Jef Poskanzer.
.SH DOCUMENT SOURCE
This manual page was generated by the Netpbm tool 'makeman' from HTML
source. The master documentation is at
.IP
.B http://netpbm.sourceforge.net/doc/ppmhist.html
.PP
|