1Ppmhist User Manual(0)                                  Ppmhist User Manual(0)
2
3
4

NAME

6       ppmhist - print a histogram of the colors in a PPM image
7
8

SYNOPSIS

10       ppmhist  [-hexcolor  | -float | -colorname | -map] [-nomap] [-noheader]
11       [-sort={frequency,rgb}] [-forensic [ppmfile]
12
13

DESCRIPTION

15       This program is part of Netpbm(1).
16
17       ppmhist reads a PPM image as input and generates  a  histogram  of  the
18       colors  in the image, i.e. a list of all the colors and how many pixels
19       of 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 and a summary  at  the
34       top.  Use the -noheader option to suppress those lines.
35
36       The  summary  tells you whether black or white are present and how many
37       shades of gray and color are present.  The summary was  new  in  Netpbm
38       10.82 (March 2018).
39
40
41       In each line, ppmhist identifies the color by red, green, and blue com‐
42       ponents.  By default, it lists each of  these  in  decimal,  using  the
43       exact  values  that are in the PPM input.  So if the image has a maxval
44       of 255, the numbers in the listing range from 0 to 255.  With the -hex‐
45       color  option,  you  can change these numbers to hexadecimal.  With the
46       -float option, the numbers are fractional, adjusted to a maxval of 1.
47
48       Each line lists the luminosity of the color.  It is in decimal  on  the
49       same scale as the rgb values (see above).
50
51       Each  line lists the number of pixels in the image that have the color.
52       This is in decimal.
53
54
55       PPM Output
56
57       You get this format with the -map option.
58
59       The output file is a genuine PPM image, but it is PPM Plain format  and
60       contains  comments  so  that  it  is not a lot different from the human
61       report described above.
62
63       As a PPM image, it can be useful as input to other programs  that  need
64       some  kind  of  palette.  The image is a single row with one column for
65       each distinct color in the image.
66
67       The function of PPM output is essentially the same  as  the  output  of
68       pnmcolormap all.  ppmhist is much older than pnmcolormap.
69
70
71

OPTIONS

73       -sort={frequency,rgb}
74              The  -sort  option  determines the order in which the colors are
75              listed in the output.  rgb means  to  sort  them  first  by  the
76              intensity  of the red component of the color, then of the green,
77              then of the blue, with the least intense first.  frequency means
78              to list them in order of how many pixels in the input image have
79              the color, with the most represented colors first.  Among colors
80              with the same frequency, the order is the same as with rgb.
81
82              The default is frequency.
83
84              Before  Netpbm 10.88 (September 2019), with -sort=frequency, the
85              order of colors that have the same frequency is arbitrary.
86
87
88       -hexcolor
89              Print the color components in hexadecimal.   See  output  format
90              ⟨#output⟩ .
91
92              You may not specify this option along with -float or map.
93
94
95       -float Print  the color components and the luminosity as floating point
96              numbers in the range [0,1].  See output format ⟨#output⟩ .
97
98              You may not specify this option along with -hexcolor or map.
99
100              This option was added in Netpbm 10.19 (November 2003).
101
102
103       -map   Generates a PPM file of the colormap for  the  image,  with  the
104              color histogram as comments.  See output format ⟨#output⟩ .
105
106              You may not specify this option along with -float or hexcolor.
107
108
109       -nomap Generates the histogram for human reading.  This is the default.
110
111
112       -colorname
113              Add  the  color  name  to the output.  This is the name from the
114              system color dictionary ⟨libppm.html#rgb.txt⟩ .   If  the  exact
115              color  is  not  in the color dictionary, it is the closest color
116              that is in the dictionary and is preceded  by  a  '*'.   If  you
117              don't have a system color dictionary, the program fails.
118
119              This option was added in Netpbm 10.10 (October 2002).
120
121
122       -noheader
123              Do not print the column headings.
124
125
126       -forensic
127
128              With  this  option, ppmhist works on images that contain invalid
129              sample values.  Normally, like  most  Netpbm  programs,  ppmhist
130              fails  if  it  encounters a sample value greater than the maxval
131              that the image declares.  The presence of such a value means the
132              image  is  invalid,  so  the  pixels  have no meaning.  But with
133              -forensic, ppmhist produces a histogram  of  the  actual  sample
134              values without regard to maxval.  It issues messages summarizing
135              the invalid pixels if there are any.
136
137              One use for this is to diagnose  the  problem  that  caused  the
138              invalid Netpbm image to exist.
139
140              There  is a small exception to the ability of ppmhist to process
141              invalid pixels even with -forensic: it can never process a  sam‐
142              ple  value  greater  than  65535.   Note that in the rarely used
143              Plain PPM format, it is possible for a number greater than  that
144              to appear where a sample value belongs.
145
146              This  option  was  new in Netpbm 10.66 (March 2014).  But Netpbm
147              older than 10.66 does not properly reject invalid sample values,
148              so the effect is very similar to -forensic.
149
150
151
152

SEE ALSO

154       ppm(1), pgmhist(1), pnmcolormap(1), pnmhistmap(1), ppmchange(1)
155
156

AUTHOR

158       Copyright (C) 1989 by Jef Poskanzer.
159

DOCUMENT SOURCE

161       This  manual  page was generated by the Netpbm tool 'makeman' from HTML
162       source.  The master documentation is at
163
164              http://netpbm.sourceforge.net/doc/ppmhist.html
165
166netpbm documentation            24 August 2019          Ppmhist User Manual(0)
Impressum