about summary refs log tree commit diff
path: root/ppmhist.html
blob: 3ed9a6c7d98a44d13298789c51435c481ce726aa (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML><HEAD><TITLE>Ppmhist User Manual</TITLE></HEAD>
<BODY>
<H1>ppmhist</H1>
Updated: 24 June 2005
<BR>
<A HREF="#index">Table Of Contents</A>

<A NAME="lbAB">&nbsp;</A>
<H2>NAME</H2>
ppmhist - print a histogram of the colors in a PPM image

<A NAME="lbAC">&nbsp;</A>
<H2>SYNOPSIS</H2>

<B>ppmhist</B>
[<B>-hexcolor</B> | <B>-float</B> | <B>-colorname</B> | <B>-map</B>]
[<B>-nomap</B>]
[<B>-noheader</B>]
[<B>-sort=</B>{<B>frequency</B>,<B>rgb</B>}]
[<I>ppmfile</I>]

<A NAME="lbAD">&nbsp;</A>
<H2>DESCRIPTION</H2>

<p>This program is part of <a href="index.html">Netpbm</a>.

<p><b>ppmhist</b>reads a PPM image as input and generates a histogram
of the colors in the image, i.e. a list of all the colors and how many
pixels of each color are in the image.

<a name="output"></a>
<h3>Output Format</h3>

<p>The output is in one of two basic formats:  a report for humans
and a PPM image for use by programs.  The PPM image is actually quite
readable by humans too.

<h4>Human Report</h4>

<p>You get this format by specifying (or defaulting to) the
<b>-nomap</b> option.

<p>The format is one line for each color in the input image.

<p>By default, there are two lines of column header at the top.  Use the
<b>-noheader</b> option to suppress those lines.

<p>In each line, <b>ppmhist</b> identifies the color by red, green,
and blue components.  By default, it lists each of these in decimal,
using the exact values that are in the PPM input.  So if the image has
a maxval of 255, the numbers in the listing range from 0 to 255.  With
the <b>-hexcolor</b> option, you can change these numbers to
hexadecimal.  With the <b>-float</b> option, the numbers are
fractional, adjusted to a maxval of 1.

<p>Each line lists the luminosity of the color.  It is in decimal
on the same scale as the rgb values (see above).

<p>Each line lists the number of pixels in the image that have the color.
This is in decimal.


<h4>PPM Output</h4>

<p>You get this format with the <b>-map</b> option.

<p>The output file is a genuine PPM image, but it is PPM Plain format
and contains comments so that it is not a lot different from the
human report described above.

<p>As a PPM image, it can be useful as input to other programs that
need some kind of palette.  The image is a single row with one
column for each distinct color in the image.


<A NAME="lbAE">&nbsp;</A>
<H2>OPTIONS</H2>

<DL COMPACT>

<DT><B>-sort=</B>{<B>frequency</B>,<B>rgb</B>}

<DD>The <B>-sort</B> option determines the order in which the colors
are listed in the output.  <B>frequency</B> means to list them in
order of how pixels in the input image have the color, with the most
represented colors first.  <B>rgb</B> means to sort them first by the
intensity of the red component of the color, then of the green, then of
the blue, with the least intense first.  

<P>The default is <B>frequency</B>.

<DT><B>-hexcolor</B>

<DD>Print the color components in hexadecimal.  See <a
href="#output">output format</a>.

<p>You may not specify this option along with <b>-float</b> or <b>map</b>.

<DT><B>-float</B>

<DD>Print the color components and the luminosity as floating point
numbers in the range [0,1].  See <a href="#output">output format</a>.

<p>You may not specify this option along with <b>-hexcolor</b> or <b>map</b>.

<p>This option was added in Netpbm 10.19 (November 2003).

<DT><B>-map</B>

<DD>Generates a PPM file of the colormap for the image, with the
color histogram as comments.  See <a href="#output">output format</a>.

<p>You may not specify this option along with <b>-float</b> or <b>hexcolor</b>.

<DT><B>-nomap</B>

<DD>
Generates the histogram for human reading.  This is the default.

<DT><B>-colorname</b>

<dd>Add the color name to the output.  This is the name from the <a
href="libppm.html#rgb.txt">system color dictionary</a>.  If the exact
color is not in the color dictionary, it is the closest color that is
in the dictionary and is preceded by a '*'.  If you don't have a 
system color dictionary, the program fails.

<p>This option was added in Netpbm 10.10 (October 2002).

<DT><B>-noheader</B>

<DD>Do not print the column headings.

</DL>

<A NAME="lbAF">&nbsp;</A>
<H2>SEE ALSO</H2>

<B><A HREF="ppm.html">ppm</A></B>,

<B><A HREF="pgmhist.html">pgmhist</A></B>,

<B><A HREF="pnmcolormap.html">pnmcolormmap</A></B>,

<B><A HREF="pnmhistmap.html">pnmhistmap</A></B>,

<B><A HREF="ppmchange.html">ppmchange</A></B>

<P>
<A NAME="lbAG">&nbsp;</A>
<H2>AUTHOR</H2>

Copyright (C) 1989 by Jef Poskanzer.

<HR>
<A NAME="index">&nbsp;</A>
<H2>Table Of Contents</H2>
<UL>
<LI><A HREF="#lbAB">NAME</A>
<LI><A HREF="#lbAC">SYNOPSIS</A>
<LI><A HREF="#lbAD">DESCRIPTION</A>
<LI><A HREF="#lbAE">OPTIONS</A>
<LI><A HREF="#lbAF">SEE ALSO</A>
<LI><A HREF="#lbAG">AUTHOR</A>
</UL>
</BODY>
</HTML>