Portable Maps

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.

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
FormatTImageFormat equivalentLoadingSavingSupported By Map Format
1 bit mono ifGray8 YesNoPBM, PAM
1bit mono + alpha ifA8Gray8 YesNoPAM
8 bit grayscale ifGray8 YesYesPGM, PAM
16 bit grayscale ifGray16 YesYesPGM, PAM
8 bit grayscale + alpha ifA8Gray8 YesYesPAM
16 bit grayscale + alpha ifA16Gray16 YesYesPAM
24 bit RGB ifR8G8B8 YesYesPPM, PAM
48 bit RGB ifR16G16B16 YesYesPPM, PAM
32 bit ARGB ifA8R8G8B8 YesYesPAM
64 bit ARGB ifA16R16G16B16 YesYesPAM
32 bit R FP32 ifR32F YesYesPFM
96 bit RGB FP32 ifA32R32G32B32F YesYesPFM

When working with PNM files you can find useful some options which can be set by SetOption function and their current values can be get by GetOption function. Or you can set them by modifying properties of TPGMFileFormat and TPPMFileFormat classes.

Options Related to PNM Files
OptionIdAllowed ValuesUsage
ImagingPGMSaveBinary 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).
ImagingPPMSaveBinary 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).