[UP]


Manual Reference Pages  - ppm (5)

NAME

ppm - portable pixmap file format

CONTENTS

Description
Author

DESCRIPTION

The portable pixmap format is a lowest common denominator color image file format. The definition is as follows:
o A "magic number" for identifying the file type. A ppm file’s magic number is the two characters "P3".
o Whitespace (blanks, TABs, CRs, LFs).
o A width, formatted as ASCII characters in decimal.
o Whitespace.
o A height, again in ASCII decimal.
o Whitespace.
o The maximum color-component value, again in ASCII decimal.
o Whitespace.
o Width * height pixels, each three ASCII decimal values between 0 and the specified maximum value, starting at the
top-left corner of the pixmap,
  proceeding in normal English reading order. The three values for each pixel represent red, green, and blue, respectively; a value of 0 means that color is off, and the maximum value means that color is maxxed out.
o Characters from a "#" to the next end-of-line are ignored (comments).
o No line should be longer than 70 characters.
Here is an example of a small pixmap in this format: P3 # feep.ppm 4 4 15
0 0 0 0 0 0 0 0 0 15 0 15
0 0 0 0 15 7 0 0 0 0 0 0
0 0 0 0 0 0 0 15 7 0 0 0
15 0 15 0 0 0 0 0 0 0 0 0
Programs that read this format should be as lenient as possible, accepting anything that looks remotely like a pixmap.
There is also a variant on the format, available by setting the RAWBITS option at compile time. This variant is different in the following ways:
o The "magic number" is "P6" instead of "P3".
o The pixel values are stored as plain bytes, instead of ASCII decimal.
o Whitespace is not allowed in the pixels area, and only a single character of whitespace (typically a newline) is allowed after the maxval.
o The files are smaller and many times faster to read and write.
Note that this raw format can only be used for maxvals less than or equal to 255. If you use the ppm library and try to
write a file with a larger maxval,
  it will automatically fall back on the slower but more general plain format.

AUTHOR

Copyright (C) 1989, 1991 by Jef Poskanzer.

                 Last change: 27 September 1991


ppm (5) March 11, 2021
Generated by manServer 1.08 from 1402f92c-2cb3-4b5a-af41-504adf5e350a using man macros.