File Format Description
Each format differs in what colors it is designed to represent:
- PBM is for bitmaps (black and white, no grays)
- PGM is for grayscale
- PPM is for "pixmaps" which represent full RGB color.
Each file starts with a two-byte magic number (in ASCII) that explains the type of file it is (PBM, PGM, and PPM) and its encoding (ASCII or binary). The magic number is a capital P followed by a single digit number.
Magic Number | Type | Encoding |
---|---|---|
P1 |
Portable bitmap | ASCII |
P2 |
Portable graymap | ASCII |
P3 |
Portable pixmap | ASCII |
P4 |
Portable bitmap | Binary |
P5 |
Portable graymap | Binary |
P6 |
Portable pixmap | Binary |
The ASCII based formats allow for human-readability and easy transport to other platforms (so long as those platforms understand ASCII), while the binary formats are more efficient both at saving space in the file, as well as being easier to parse due to the absence of whitespace.
When using the binary formats, PBM uses 1 bit per pixel, PGM uses 8 bits per pixel, and PPM uses 24 bits per pixel: 8 for red, 8 for green, 8 for blue.
Read more about this topic: Netpbm Format
Famous quotes containing the words file and/or description:
“I have been a soreheaded occupant of a file drawer labeled Science Fiction ... and I would like out, particularly since so many serious critics regularly mistake the drawer for a urinal.”
—Kurt Vonnegut, Jr. (b. 1922)
“The Sage of Toronto ... spent several decades marveling at the numerous freedoms created by a global village instantly and effortlessly accessible to all. Villages, unlike towns, have always been ruled by conformism, isolation, petty surveillance, boredom and repetitive malicious gossip about the same families. Which is a precise enough description of the global spectacles present vulgarity.”
—Guy Debord (b. 1931)