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

SEE ALSO

162       ppm(1), pgmhist(1), pnmcolormap(1), pnmhistmap(1), ppmchange(1)
163
164

AUTHOR

166       Copyright (C) 1989 by Jef Poskanzer.
167

DOCUMENT SOURCE

169       This  manual  page was generated by the Netpbm tool 'makeman' from HTML
170       source.  The master documentation is at
171
172              http://netpbm.sourceforge.net/doc/ppmhist.html
173
174netpbm documentation            24 August 2019          Ppmhist User Manual(0)
Impressum