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

SEE ALSO

150       ppm(1), pgmhist(1), pnmcolormap(1), pnmhistmap(1), ppmchange(1)
151
152

AUTHOR

154       Copyright (C) 1989 by Jef Poskanzer.
155

DOCUMENT SOURCE

157       This  manual  page was generated by the Netpbm tool 'makeman' from HTML
158       source.  The master documentation is at
159
160              http://netpbm.sourceforge.net/doc/ppmhist.html
161
162netpbm documentation            15 August 2015          Ppmhist User Manual(0)
Impressum