| 1 |
\ |
| 2 |
.\" This man page was generated by the Netpbm tool 'makeman' from HTML source. |
| 3 |
.\" Do not hand-hack it! If you have bug fixes or improvements, please find |
| 4 |
.\" the corresponding HTML page on the Netpbm website, generate a patch |
| 5 |
.\" against that, and send it to the Netpbm maintainer. |
| 6 |
.TH "Pgmhist User Manual" 1 "18 December 2021" "netpbm documentation" |
| 7 |
|
| 8 |
.SH NAME |
| 9 |
|
| 10 |
pgmhist - print a histogram of the values in a PGM image |
| 11 |
|
| 12 |
.UN synopsis |
| 13 |
.SH SYNOPSIS |
| 14 |
|
| 15 |
\fBpgmhist\fP |
| 16 |
|
| 17 |
[\fB-median\fP, \fB-quartile\fP, \fB-decile\fP] |
| 18 |
|
| 19 |
[\fB-forensic\fP] |
| 20 |
|
| 21 |
[\fB-machine\fP] |
| 22 |
|
| 23 |
[\fIpgmfile\fP] |
| 24 |
|
| 25 |
.UN description |
| 26 |
.SH DESCRIPTION |
| 27 |
.PP |
| 28 |
This program is part of |
| 29 |
.BR "Netpbm" (1)\c |
| 30 |
\&. |
| 31 |
.PP |
| 32 |
\fBpgmhist\fP reads a PGM image as input and prints a histogram of the |
| 33 |
gray values or other gray value distribution metrics. |
| 34 |
.PP |
| 35 |
If you specify none of \fB-median\fP, \fB-quartile\fP, or \fB-decile\fP, |
| 36 |
\fBpgmhist\fP prints a complete histogram showing how many pixels of each |
| 37 |
possible gray value exist in the image. Along with each gray value, it tells |
| 38 |
you how many pixels are at lest as black as it and how many are at least as |
| 39 |
white. |
| 40 |
.PP |
| 41 |
\fB-median\fP, \fB-quartile\fP, and \fB-decile\fP options cause |
| 42 |
\fBpgmhist\fP instead to print the indicated quantiles. Each quantile is a |
| 43 |
gray value that actually appears in the image (as opposed to fractional values |
| 44 |
that are sometimes used for quantiles). The 3rd quartile is the least gray |
| 45 |
value for which at least 75% of the pixels are as dark or darker than it. |
| 46 |
The 4th quartile is the brightest gray value that appears in the image. |
| 47 |
|
| 48 |
|
| 49 |
.UN options |
| 50 |
.SH OPTIONS |
| 51 |
.PP |
| 52 |
In addition to the options common to all programs based on libnetpbm |
| 53 |
(most notably \fB-quiet\fP, see |
| 54 |
.UR index.html#commonoptions |
| 55 |
Common Options |
| 56 |
.UE |
| 57 |
\&), \fBpgmhist\fP recognizes the following |
| 58 |
command line options: |
| 59 |
.PP |
| 60 |
You may specify at most one of \fB-median\fP, \fB-quartile\fP, and |
| 61 |
\fB-decile\fP. If none of these is specified \fBpgmhist\fP prints |
| 62 |
a histogram of gray values. |
| 63 |
|
| 64 |
|
| 65 |
.TP |
| 66 |
\fB-median\fP |
| 67 |
.sp |
| 68 |
This option causes \fBpgmhist\fP to print the median gray value. |
| 69 |
.sp |
| 70 |
This option was new in Netpbm 10.61 (December 2012). |
| 71 |
|
| 72 |
.TP |
| 73 |
\fB-quartile\fP |
| 74 |
.sp |
| 75 |
This option causes \fBpgmhist\fP to print the four quartile gray values. |
| 76 |
.sp |
| 77 |
This option was new in Netpbm 10.61 (December 2012). |
| 78 |
|
| 79 |
.TP |
| 80 |
\fB-decile\fP |
| 81 |
.sp |
| 82 |
This option causes \fBpgmhist\fP to print the ten decile gray values. |
| 83 |
.sp |
| 84 |
This option was new in Netpbm 10.61 (December 2012). |
| 85 |
|
| 86 |
.TP |
| 87 |
\fB-forensic\fP |
| 88 |
.sp |
| 89 |
With this option, \fBpgmhist\fP works on images that contain invalid gray |
| 90 |
values. Normally, like most Netpbm programs, \fBpgmhist\fP fails if it |
| 91 |
encounters a gray value greater than the maxval that the image declares. The |
| 92 |
presence of such a value means the image is invalid, so the pixels have no |
| 93 |
meaning. But with \fB-forensic\fP, \fBpgmhist\fP produces a histogram |
| 94 |
of the actual gray values without regard to maxval. It issues messages |
| 95 |
summarizing the invalid pixels if there are any. |
| 96 |
.sp |
| 97 |
One use for this is to diagnose the problem that caused the invalid Netpbm |
| 98 |
image to exist. |
| 99 |
.sp |
| 100 |
There is a small exception to the ability of \fBpgmhist\fP to process |
| 101 |
invalid pixels even with \fB-forensic\fP: it can never process a gray value |
| 102 |
greater than 65535. Note that in the rarely used Plain PGM format, it is |
| 103 |
possible for a number greater than that to appear where a gray value belongs. |
| 104 |
.sp |
| 105 |
This option was new in Netpbm 10.66 (March 2014). But Netpbm older than |
| 106 |
10.66 does not properly reject invalid sample values, so the effect is very |
| 107 |
similar to \fB-forensic\fP. |
| 108 |
|
| 109 |
.TP |
| 110 |
\fB-machine\fP |
| 111 |
.sp |
| 112 |
This option causes \fBpgmhist\fP to print the information in a way |
| 113 |
easily digestible by a machine as opposed to a human. |
| 114 |
.sp |
| 115 |
For the quantiles, there is one line per quantile, in quantile order, and |
| 116 |
it consists of the gray value of the quantile in decimal with no leading |
| 117 |
zeroes. |
| 118 |
.sp |
| 119 |
For the full histogram output, it consists of one line per possible |
| 120 |
gray value (whether that value appears in the image or not), in order of |
| 121 |
the gray values. The line consists of two tokens separated by a space. The |
| 122 |
first is the gray value; the second is the number of pixels in the image that |
| 123 |
have that gray value. Both are decimal numbers without leading zeroes. |
| 124 |
.sp |
| 125 |
This option was new in Netpbm 10.61 (December 2012). |
| 126 |
|
| 127 |
|
| 128 |
|
| 129 |
|
| 130 |
.UN seealso |
| 131 |
.SH SEE ALSO |
| 132 |
.BR "pnmnorm" (1)\c |
| 133 |
\&, |
| 134 |
.BR "ppmhist" (1)\c |
| 135 |
\&, |
| 136 |
.BR "pgm" (1)\c |
| 137 |
\& |
| 138 |
|
| 139 |
.UN author |
| 140 |
.SH AUTHOR |
| 141 |
|
| 142 |
Copyright (C) 1989 by Jef Poskanzer. |
| 143 |
.SH DOCUMENT SOURCE |
| 144 |
This manual page was generated by the Netpbm tool 'makeman' from HTML |
| 145 |
source. The master documentation is at |
| 146 |
.IP |
| 147 |
.B http://netpbm.sourceforge.net/doc/pgmhist.html |
| 148 |
.PP |