ImageGear .NET v25.2 - Updated
PGM
Developer Guide > File Formats and Compressions > File Formats > File Formats Reference > PGM
Full Name PGM (Portable Graymap File Format)
Format ID ImGearFormats.PBM (see the Note below)
File Extension(s) *.pgm
Data Type Raster Image
Data Encoding Binary
Multi-Page Support No
Alpha Channel Support No
Metadata Update Support No
ImageGear Platforms Support WIN32, WIN64, Unix, Unix64, .NET, .NET64, MAC
ImageGear supports PGM file format via its PBM format filter. Use ImGearFormats.PBM to save images to PGM format.

ImageGear Supported Versions

October 1991 - last release

ImageGear Supported Features

ImageGear Read Support

ImageGear Write Support

ImageGear Filter Control Parameters

None

Comments

This format quickly and easily transfers grayscale bitmap images. This format, as well as PBM, PNM, and PPM, are at the core of a set of utility programs also written by Jef Poskanzer. These formats serve as an intermediary storage methods for the conversion of other file formats.

The Portable Graymap File Format structure is very simple. It begins with a short ASCII header that contains the file type identifier (magic number), the width and height of the image, a "maximum gray value", and perhaps a comment line identifying the filename. The bitmap data follows white space (usually a carriage return). The number of pixels is equal to width * height. A pixel value of 0 indicates black, and a "maximum gray value" is equivalent to white.

The magic number of the header can have one of two values: either P2 or P5. P2 indicates that the bitmap data is read as ASCII decimal values. P5 indicates that the bitmap data is stored as plain bytes. This makes for a smaller and faster-to-read file.

If the maximum gray value does not exceed 255 (28 = 256 gray values from 0 to 255), each pixel is represented by a 8-bit sample. ImageGear loads such images as 8-bit grayscale. Otherwise, each pixel is represented by a 16-bit sample. ImageGear loads these images as 16-bit grayscale.

References Used

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

PGM Specification by Jef Poskanzer, copyright A 1989, 1991.

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