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:
“While waiting to get married, several forms of employment were acceptable. Teaching kindergarten was for those girls who stayed in school four years. The rest were secretaries, typists, file clerks, or receptionists in insurance firms or banks, preferably those owned or run by the family, but respectable enough if the boss was an upstanding Christian member of the community.”
—Barbara Howar (b. 1934)
“As they are not seen on their way down the streams, it is thought by fishermen that they never return, but waste away and die, clinging to rocks and stumps of trees for an indefinite period; a tragic feature in the scenery of the river bottoms worthy to be remembered with Shakespeares description of the sea-floor.”
—Henry David Thoreau (18171862)