1Ppmhist User Manual(0) Ppmhist User Manual(0)
2
3
4
6 ppmhist - print a histogram of the colors in a PPM image
7
8
10 ppmhist [-hexcolor | -float | -colorname | -map] [-nomap] [-noheader]
11 [-sort={frequency,rgb}] [-forensic [ppmfile]
12
13
15 This program is part of Netpbm(1).
16
17 ppmhistreads a PPM image as input and generates a histogram of the col‐
18 ors in the image, i.e. a list of all the colors and how many pixels of
19 each color are in the image.
20
21
22 Output Format
23 The output is in one of two basic formats: a report for humans and a
24 PPM image for use by programs. The PPM image is actually quite read‐
25 able by humans too.
26
27 Human Report
28
29 You get this format by specifying (or defaulting to) the -nomap option.
30
31 The format is one line for each color in the input image.
32
33 By default, there are two lines of column header at the top. Use the
34 -noheader option to suppress those lines.
35
36 In each line, ppmhist identifies the color by red, green, and blue com‐
37 ponents. By default, it lists each of these in decimal, using the
38 exact values that are in the PPM input. So if the image has a maxval
39 of 255, the numbers in the listing range from 0 to 255. With the -hex‐
40 color option, you can change these numbers to hexadecimal. With the
41 -float option, the numbers are fractional, adjusted to a maxval of 1.
42
43 Each line lists the luminosity of the color. It is in decimal on the
44 same scale as the rgb values (see above).
45
46 Each line lists the number of pixels in the image that have the color.
47 This is in decimal.
48
49
50 PPM Output
51
52 You get this format with the -map option.
53
54 The output file is a genuine PPM image, but it is PPM Plain format and
55 contains comments so that it is not a lot different from the human
56 report described above.
57
58 As a PPM image, it can be useful as input to other programs that need
59 some kind of palette. The image is a single row with one column for
60 each distinct color in the image.
61
62 The function of PPM output is essentially the same as the output of
63 pnmcolormap all. ppmhist is much older than pnmcolormap.
64
65
66
68 -sort={frequency,rgb}
69 The -sort option determines the order in which the colors are
70 listed in the output. frequency means to list them in order of
71 how pixels in the input image have the color, with the most rep‐
72 resented colors first. rgb means to sort them first by the
73 intensity of the red component of the color, then of the green,
74 then of the blue, with the least intense first.
75
76 The default is frequency.
77
78
79 -hexcolor
80 Print the color components in hexadecimal. See output format
81 ⟨#output⟩ .
82
83 You may not specify this option along with -float or map.
84
85
86 -float Print the color components and the luminosity as floating point
87 numbers in the range [0,1]. See output format ⟨#output⟩ .
88
89 You may not specify this option along with -hexcolor or map.
90
91 This option was added in Netpbm 10.19 (November 2003).
92
93
94 -map Generates a PPM file of the colormap for the image, with the
95 color histogram as comments. See output format ⟨#output⟩ .
96
97 You may not specify this option along with -float or hexcolor.
98
99
100 -nomap Generates the histogram for human reading. This is the default.
101
102
103 -colorname
104 Add the color name to the output. This is the name from the
105 system color dictionary ⟨libppm.html#rgb.txt⟩ . If the exact
106 color is not in the color dictionary, it is the closest color
107 that is in the dictionary and is preceded by a '*'. If you
108 don't have a system color dictionary, the program fails.
109
110 This option was added in Netpbm 10.10 (October 2002).
111
112
113 -noheader
114 Do not print the column headings.
115
116
117 -forensic
118
119 With this option, ppmhist works on images that contain invalid
120 sample values. Normally, like most Netpbm programs, ppmhist
121 fails if it encounters a sample value greater than the maxval
122 that the image declares. The presence of such a value means the
123 image is invalid, so the pixels have no meaning. But with
124 -forensic, ppmhist produces a histogram of the actual sample
125 values without regard to maxval. It issues messages summarizing
126 the invalid pixels if there are any.
127
128 One use for this is to diagnose the problem that caused the
129 invalid Netpbm image to exist.
130
131 There is a small exception to the ability of ppmhist to process
132 invalid pixels even with -forensic: it can never process a sam‐
133 ple value greater than 65535. Note that in the rarely used
134 Plain PPM format, it is possible for a number greater than that
135 to appear where a sample value belongs.
136
137 This option was new in Netpbm 10.66 (March 2014). But Netpbm
138 older than 10.66 does not properly reject invalid sample values,
139 so the effect is very similar to -forensic.
140
141
142
143
145 ppm(1), pgmhist(1), pnmcolormap(1), pnmhistmap(1), ppmchange(1)
146
147
149 Copyright (C) 1989 by Jef Poskanzer.
150
152 This manual page was generated by the Netpbm tool 'makeman' from HTML
153 source. The master documentation is at
154
155 http://netpbm.sourceforge.net/doc/ppmhist.html
156
157netpbm documentation 15 August 2015 Ppmhist User Manual(0)