version 2, including all changes.
.
Rev |
Author |
# |
Line |
1 |
perry |
1 |
ppm |
|
|
2 |
!!!ppm |
|
|
3 |
NAME |
|
|
4 |
DESCRIPTION |
|
|
5 |
COMPATIBILITY |
|
|
6 |
SEE ALSO |
|
|
7 |
AUTHOR |
|
|
8 |
---- |
|
|
9 |
!!NAME |
|
|
10 |
|
|
|
11 |
|
|
|
12 |
ppm - portable pixmap file format |
|
|
13 |
!!DESCRIPTION |
|
|
14 |
|
|
|
15 |
|
|
|
16 |
The portable pixmap format is a lowest common denominator |
|
|
17 |
color image file format. |
|
|
18 |
|
|
|
19 |
|
|
|
20 |
It should be noted that this format is egregiously |
|
|
21 |
inefficient. It is highly redundant, while containing a lot |
|
|
22 |
of information that the human eye can't even discern. |
|
|
23 |
Furthermore, the format allows very little information about |
|
|
24 |
the image besides basic color, which means you may have to |
|
|
25 |
couple a file in this format with other independent |
|
|
26 |
information to get any decent use out of it. However, it is |
|
|
27 |
very easy to write and analyze programs to process this |
|
|
28 |
format, and that is the point. |
|
|
29 |
|
|
|
30 |
|
|
|
31 |
It should also be noted that files often conform to this |
|
|
32 |
format in every respect except the precise semantics of the |
|
|
33 |
sample values. These files are useful because of the way PPM |
|
|
34 |
is used as an intermediary format. They are informally |
|
|
35 |
called PPM files, but to be absolutely precise, you should |
|
|
36 |
indicate the variation from true PPM. For example, |
|
|
37 |
|
|
|
38 |
|
|
|
39 |
The format definition is as follows. |
|
|
40 |
|
|
|
41 |
|
|
|
42 |
A PPM file consists of a sequence of one or more PPM images. |
|
|
43 |
There are no data, delimiters, or padding before, after, or |
|
|
44 |
between images. |
|
|
45 |
|
|
|
46 |
|
|
|
47 |
Each PPM image consists of the following: |
|
|
48 |
|
|
|
49 |
|
|
|
50 |
- |
|
|
51 |
|
|
|
52 |
|
|
|
53 |
A |
|
|
54 |
|
|
|
55 |
|
|
|
56 |
- |
|
|
57 |
|
|
|
58 |
|
|
|
59 |
Whitespace (blanks, TABs, CRs, LFs). |
|
|
60 |
|
|
|
61 |
|
|
|
62 |
- |
|
|
63 |
|
|
|
64 |
|
|
|
65 |
A width, formatted as ASCII characters in |
|
|
66 |
decimal. |
|
|
67 |
|
|
|
68 |
|
|
|
69 |
- |
|
|
70 |
|
|
|
71 |
|
|
|
72 |
Whitespace. |
|
|
73 |
|
|
|
74 |
|
|
|
75 |
- |
|
|
76 |
|
|
|
77 |
|
|
|
78 |
A height, again in ASCII decimal. |
|
|
79 |
|
|
|
80 |
|
|
|
81 |
- |
|
|
82 |
|
|
|
83 |
|
|
|
84 |
Whitespace. |
|
|
85 |
|
|
|
86 |
|
|
|
87 |
- |
|
|
88 |
|
|
|
89 |
|
|
|
90 |
The maximum color value (Maxval), again in ASCII decimal. |
|
|
91 |
Must be less than 65536. |
|
|
92 |
|
|
|
93 |
|
|
|
94 |
- |
|
|
95 |
|
|
|
96 |
|
|
|
97 |
Newline or other single whitespace character. |
|
|
98 |
|
|
|
99 |
|
|
|
100 |
- |
|
|
101 |
|
|
|
102 |
|
|
|
103 |
A raster of Width * Height pixels, proceeding through the |
|
|
104 |
image in normal English reading order. Each pixel is a |
|
|
105 |
triplet of red, green, and blue samples, in that order. Each |
|
|
106 |
sample is represented in pure binary by either 1 or 2 bytes. |
|
|
107 |
If the Maxval is less than 256, it is 1 byte. Otherwise, it |
|
|
108 |
is 2 bytes. The most significant byte is first. |
|
|
109 |
|
|
|
110 |
|
|
|
111 |
- |
|
|
112 |
|
|
|
113 |
|
|
|
114 |
In the raster, the sample values are |
|
|
115 |
|
|
|
116 |
|
|
|
117 |
- |
|
|
118 |
|
|
|
119 |
|
|
|
120 |
Note that a common variation on the PPM format is to have |
|
|
121 |
the sample values be |
|
|
122 |
pnmgamma__ |
|
|
123 |
takes such a PPM variant as input and produces a true PPM as |
|
|
124 |
output. |
|
|
125 |
|
|
|
126 |
|
|
|
127 |
- |
|
|
128 |
|
|
|
129 |
|
|
|
130 |
Characters from a |
|
|
131 |
|
|
|
132 |
|
|
|
133 |
Note that you can use __pnmdepth__ to convert between a |
|
|
134 |
the format with 1 byte per sample and the one with 2 bytes |
|
|
135 |
per sample. |
|
|
136 |
|
|
|
137 |
|
|
|
138 |
There is actually another version of the PPM format that is |
|
|
139 |
fairly rare: |
|
|
140 |
pbm__(5) for some |
|
|
141 |
commentary on how plain and raw formats relate to one |
|
|
142 |
another. |
|
|
143 |
|
|
|
144 |
|
|
|
145 |
The difference in the plain format is: |
|
|
146 |
|
|
|
147 |
|
|
|
148 |
- |
|
|
149 |
|
|
|
150 |
|
|
|
151 |
There is exactly one image in a file. |
|
|
152 |
|
|
|
153 |
|
|
|
154 |
- |
|
|
155 |
|
|
|
156 |
|
|
|
157 |
The magic number is P3 instead of P6. |
|
|
158 |
|
|
|
159 |
|
|
|
160 |
- |
|
|
161 |
|
|
|
162 |
|
|
|
163 |
Each sample in the raster is represented as an ASCII decimal |
|
|
164 |
number (of arbitrary size). |
|
|
165 |
|
|
|
166 |
|
|
|
167 |
- |
|
|
168 |
|
|
|
169 |
|
|
|
170 |
Each sample in the raster has white space before and after |
|
|
171 |
it. There must be at least one character of white space |
|
|
172 |
between any two samples, but there is no maximum. There is |
|
|
173 |
no particular separation of one pixel from another -- just |
|
|
174 |
the required separation between the blue sample of one pixel |
|
|
175 |
from the red sample of the next pixel. |
|
|
176 |
|
|
|
177 |
|
|
|
178 |
- |
|
|
179 |
|
|
|
180 |
|
|
|
181 |
No line should be longer than 70 characters. |
|
|
182 |
|
|
|
183 |
|
|
|
184 |
Here is an example of a small pixmap in this |
|
|
185 |
format: |
|
|
186 |
|
|
|
187 |
|
|
|
188 |
P3 |
|
|
189 |
# feep.ppm |
|
|
190 |
4 4 |
|
|
191 |
15 |
|
|
192 |
0 0 0 0 0 0 0 0 0 15 0 15 |
|
|
193 |
0 0 0 0 15 7 0 0 0 0 0 0 |
|
|
194 |
0 0 0 0 0 0 0 15 7 0 0 0 |
|
|
195 |
15 0 15 0 0 0 0 0 0 0 0 0 |
|
|
196 |
Programs that read this format should be as lenient as possible, accepting anything that looks remotely like a pixmap. |
|
|
197 |
!!COMPATIBILITY |
|
|
198 |
|
|
|
199 |
|
|
|
200 |
Before April 2000, a raw format PPM file could not have a |
|
|
201 |
maxval greater than 255. Hence, it could not have more than |
|
|
202 |
one byte per sample. Old programs may depend on |
|
|
203 |
this. |
|
|
204 |
|
|
|
205 |
|
|
|
206 |
Before July 2000, there could be at most one image in a PPM |
|
|
207 |
file. As a result, most tools to process PPM files ignore |
|
|
208 |
(and don't read) any data after the first |
|
|
209 |
image. |
|
|
210 |
!!SEE ALSO |
|
|
211 |
|
|
|
212 |
|
|
|
213 |
giftopnm(1), gouldtoppm(1), ilbmtoppm(1), imgtoppm(1), |
|
|
214 |
mtvtoppm(1), pcxtoppm(1), pgmtoppm(1), pi1toppm(1), |
|
|
215 |
picttoppm(1), pjtoppm(1), qrttoppm(1), rawtoppm(1), |
|
|
216 |
rgb3toppm(1), sldtoppm(1), spctoppm(1), sputoppm(1), |
|
|
217 |
tgatoppm(1), ximtoppm(1), xpmtoppm(1), yuvtoppm(1), |
|
|
218 |
ppmtoacad(1), ppmtogif(1), ppmtoicr(1), ppmtoilbm(1), |
|
|
219 |
ppmtopcx(1), ppmtopgm(1), ppmtopi1(1), ppmtopict(1), |
|
|
220 |
ppmtopj(1), ppmtopuzz(1), ppmtorgb3(1), ppmtosixel(1), |
|
|
221 |
ppmtotga(1), ppmtouil(1), ppmtoxpm(1), ppmtoyuv(1), |
|
|
222 |
ppmdither(1), ppmforge(1), ppmhist(1), ppmmake(1), |
|
|
223 |
ppmpat(1), ppmquant(1), ppmquantall(1), ppmrelief(1), |
2 |
GreigMcGill |
224 |
pnm(5), pgm(5), pbm(5), 411toppm(1) |
1 |
perry |
225 |
!!AUTHOR |
|
|
226 |
|
|
|
227 |
|
|
|
228 |
Copyright (C) 1989, 1991 by Jef Poskanzer. |
|
|
229 |
---- |