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