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}] [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
63
65 -sort={frequency,rgb}
66 The -sort option determines the order in which the colors are
67 listed in the output. frequency means to list them in order of
68 how pixels in the input image have the color, with the most rep‐
69 resented colors first. rgb means to sort them first by the
70 intensity of the red component of the color, then of the green,
71 then of the blue, with the least intense first.
72
73 The default is frequency.
74
75
76 -hexcolor
77 Print the color components in hexadecimal. See output format
78 ⟨#output⟩ .
79
80 You may not specify this option along with -float or map.
81
82
83 -float Print the color components and the luminosity as floating point
84 numbers in the range [0,1]. See output format ⟨#output⟩ .
85
86 You may not specify this option along with -hexcolor or map.
87
88 This option was added in Netpbm 10.19 (November 2003).
89
90
91 -map Generates a PPM file of the colormap for the image, with the
92 color histogram as comments. See output format ⟨#output⟩ .
93
94 You may not specify this option along with -float or hexcolor.
95
96
97 -nomap Generates the histogram for human reading. This is the default.
98
99
100 -colorname
101 Add the color name to the output. This is the name from the
102 system color dictionary ⟨libppm.html#rgb.txt⟩ . If the exact
103 color is not in the color dictionary, it is the closest color
104 that is in the dictionary and is preceded by a '*'. If you
105 don't have a system color dictionary, the program fails.
106
107 This option was added in Netpbm 10.10 (October 2002).
108
109
110 -noheader
111 Do not print the column headings.
112
113
114
115
117 ppm(1), pgmhist(1), pnmcolormmap(1), pnmhistmap(1), ppmchange(1)
118
120 Copyright (C) 1989 by Jef Poskanzer.
121
122
123
124netpbm documentation 24 June 2005 Ppmhist User Manual(0)