ImageGear for Java User Guide > ImageGear Imaging Formats Reference > ImageGear Supported File Formats Reference > PNM |
Full Name | PNM (Portable Any-Map File Format) |
Format ID | ImGearFormats.PBM (See the Note below) |
File Extension(s) | *.pnm |
Data Type | Raster Image |
Data Encoding | Binary |
IG Multipage Support | No |
IG Alpha Channel Support | No |
IG Platforms Support | WIN32, WIN64, Linux32, Linux64, MAC32, MAC64 |
ImageGear supports PNM file format via its PBM format filter. Use ImGearFormats.PBM to save images to PNM format. |
October 1991 - last release
None
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.
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 A 1989, 1991.