ImageGear for C and C++ on Windows v20.0 - Updated
PNM
User Guide > File Formats and Compressions > File Formats > File Formats Reference > PNM

Full Name PNM (Portable Any-Map File Format)
Format ID IG_FORMAT_PBM = 28 (See the Note below)
File Extension(s) *.pnm
Data Type Raster Image
Data Encoding Binary
Color Profile Support No
Multi-Page Support No
Alpha Channel Support No
ImageGear supports PNM file format via its IG_FORMAT_PBM format filter. Use IG_FORMAT_PBM to save images to PNM format.

ImageGear Supported Versions:

October 1991 - last release

ImageGear Supported Features:

ImageGear Read Support:

ImageGear Write Support:

ImageGear Filter Control Parameters:

None

Comments:

The PNM format is useful for quick and easy transfer of uncomplicated monochrome, grayscale, or color bitmap images. This format, as well as the PBM, PGM, and PPM formats, are at the core of a set of utility programs also written by Jef Poskanzer. These formats serve as intermediary storage methods for the conversion of other file formats. For example, a function called gifftoppm translates a GIF file to a PPM, from where it can be then translated to a TIFF using the pnmtotiff.

The Portable Anymap File Format structure is very simple. The "Anymap" portion of its name refers to the fact that it can be one of three types of UNIX bitmap file formats: the Portable Bitmap File Format (PBM), the Portable Graymap File Format (PGM), or the Portable Pixelmap File Format (PPM). A PNM begins with a short ASCII header that contains the file type identifier (magic number), the width and height of the image, a "maximum color-component value" if it is a PPM, a "maximum gray value" if it is a PGM, and perhaps a comment line identifying the filename. Following white space (usually a carriage return) is the bitmap data. For PGM and PPM files, the number of pixels is equal to width * height (whereas, in a PBM file, this calculation gives you the number of bits).

The magic number of the header can have one of six values depending on whether the bitmap is in PBM, PGM, or PPM format. Each format can have one of two magic numbers depending on whether the pixel data is stored in ASCII decimal or plain bytes. See the descriptions for the individual formats (these are all supported by ImageGear) for more details.

References Used

Kay, David C. and John R. Levine. Graphics File Formats, 2nd ed. Windcrest /McGraw-Hill, 1995.

PBM, PGM, PPM, PNM Specifications by Jef Poskanzer, copyright 1989, 1991.

Is this page helpful?
Yes No
Thanks for your feedback.