| Portable Pixmap File Format |
Article Index for Portable |
Website Links For Portable |
Information AboutPortable Pixmap File Format |
| CATEGORIES ABOUT PORTABLE PIXMAP | |
| graphics file formats | |
The portable pixmap file format ('''PPM'''), the '''portable graymap file format''' ('''PGM''') and the '''portable bitmap file format''' ('''PBM''') specify rules for exchanging graphics files. They provide very basic functionality and serve as a least-common-denominator for converting Pixmap , Graymap , or Bitmap files between different platforms. The Netpbm file conversion package refers to them collectively as the '''PNM format'''. NETPBM USAGE The Netpbm package can, for example, use two successive conversion programs to turn this code into a Bmp file: pgmtoppm "#FFFFFF" j.pbm > j.ppm ppmtobmp j.ppm > j.bmp Depending on the identification of the file format, portable pixmap systems can distinguish three similar file formats, each with two versions:
In each case, the lower-numbered version (P1, P2 or P3) refers to a human-readable, ASCII -based format similar to the one in the example above; and the higher-numbered version (P4, P5 or P6) refers to a binary format, not human-readable but more efficient at saving some space in the file, as well as easier to parse due to the lack of Whitespace . FILE FORMAT DESCRIPTION Take the example of the letter "J" from the Bitmap article: ....X. ....X. ....X. ....X. ....X. ....X. X...X. .XXX.. ...... ...... The most basic (monochrome) PBM format represents it as follows: P1 # This is an example bit map file j.pbm 6 10 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 1 0 0 0 1 0 0 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 The string ''P1'' identifies the file format. The hash sign introduces a comment. The next two numbers give the width and the height. Then follows the matrix with the pixel values (in the monochrome case here, only zeros and ones). The PGM and PPM formats (both ASCII and binary versions) have an additional parameter for the maximum value in a line between the X and Y dimensions and the actual pixel data. 16-BIT EXTENSIONS The original definition of the PGM and the PPM binary formats (the P5 and P6 formats) did not support bit-depths greater than 8 bits. One can of course use the ASCII format, but this format both slows down reading and makes the files much larger. Accordingly, many programmers have attempted to extend the format to support higher bit-depths. Using higher bit-depths encounters the problem of having to decide on the Endianess of the file. Unfortunately it appears that the various implementations could not agree on which byte order to use! ( Netpbm , the '' De Facto '' standard implementation of the PNM formats, uses big-endian.) EXTERNAL LINKS
|
|
|