Portable Maps or AnyMaps (PNM) is collective name refering to family of very similar raster file formats. Their format is very simple and most of them contain just two-byte Id, Width, Height, and raster data. Data can be stored in binary format or in text format (whick produces very large files). Most formats can store images with 8 or 16 bit channels but not all viewer and editor programs support 16 bit PNMs (or binary ones). Imaging supports five PNM formats where PBM, PGM, and PPM are quite common but PAM and PFM are somewhat rare.
PBM - Portable Bit Map
stores monochrome 1bit images. Raster data
can be saved as text or binary data. Either way value of 0 represents white
and 1 is black. As Imaging does not have support for 1bit data formats
PBM images can be loaded but not saved. Loaded images are returned in
ifGray8 format (witch pixel values scaled from 1bit to 8bit).
PBM - Portable Gray Map
stores grayscale 8bit or 16bit images. Raster data can be
saved as text or binary data.
PPM - Portable Pixel Map
stores RGB images with 8bit or 16bit channels.
Raster data can be saved as text or binary data.
PAM - Portable Arbitrary Map
is more complex format that can store image data formats
of PBM, PGM, and PPM formats with optional alpha channel. Raster data
can be stored only in binary format.
PFM - Portable Float Map
is unofficial extension of PNM format family which
can store images with floating point pixels. Raster data is saved in
binary format as array of IEEE 32 bit floating point numbers. One channel
or RGB images are supported by PFM format (so no alpha).
There is a complete list of data formats supported by PNM file formats, their Imaging equivalents, and load/cave capability.Portable Maps File Format Support
|Format||TImageFormat equivalent||Loading||Saving||Supported By Map Format|
|1 bit mono||
|1bit mono + alpha||
|8 bit grayscale||
|16 bit grayscale||
|8 bit grayscale + alpha||
|16 bit grayscale + alpha||
|24 bit RGB||
|48 bit RGB||
|32 bit ARGB||
|64 bit ARGB||
|32 bit R FP32||
|96 bit RGB FP32||
When working with PNM files you can find useful some options which can be set by function and their current values can be get by function. Or you can set them by modifying properties of and classes.Options Related to PNM Files
|0 (false) or 1 (true)||If set to True PGM images will be saved in binary format, otherwise they will be saved in text format (which could result in 5-10x bigger file). Default value is 1 (true).|
|0 (false) or 1 (true)||If set to True PPM images will be saved in binary format, otherwise they will be saved in text format (which could result in 5-10x bigger file). Default value is 1 (true).|