PAM graphics format

From Wikipedia, the free encyclopedia

The PAM graphics format of the Netpbm package generalises all the features of the previous formats (PBM, PGM and PPM) and provides for extending them. As well as width, height and maximum value, which are found in the older formats, PAM defines two new attributes: depth and tuple type.

The depth attribute defines the number of channels in the image, such as 1 for greyscale images and 3 for RGB images. The tuple type attribute specifies what kind of image the PAM file represents, thus enabling it to stand for the older Netpbm formats, as well as to be extended to new uses. For example, an image with a tuple type of GRAYSCALE is equivalent to PGM (portable graymap).

Contents

[edit] Fundamental differences from the older formats

The header for the PAM file format begins with P7, and (unlike in the other formats) ends in an explicit close: ENDHDR.

There is no plain (human-readable, ASCII-based) version of PAM. PAM files are always binary, and attempts to use the switch -plain with Netpbm programs that produce PAM output results in an error message.

For the black-and-white version of PAM (depth 1, tuple type BLACKANDWHITE), corresponding to PBM, PAM uses one byte per pixel, instead of PBM’s use of one bit per pixel (packing eight pixels in one byte). Also, the value 1 in such a PAM image stands for white (“light on”), as opposed to black in PBM (“ink on”).

[edit] Extended uses

Extensions that include an opacity channel exist: for example tuple type RGB_ALPHA (with depth 4) serves for RGBA images, which previously required the use of a separate PGM image for the opacity channel. In theory, PAM can be extended to represent colour models like CMYK, and even non-graphical information arrays.

[edit] See also

[edit] References