PGM, Portable Gray Map Image (.pgm)

The PGM Raster image file format

PGM files are known as portable graymap files and contain grayscale image information. These files can be saved in two representations, either as plain (ASCII) text or binary. In which way the PGM is saved is apparent in the file header. If the header contains the string "P2" it is a text format, if it contains the string "P5", it's a binary representation. Binary PGM files can contain more than one image. This is not possible for the text-based PGM. It is limited to one image.

Technical details of PGM files

Portaple Gray Map Images can be encoded using either one byte or two bytes per pixel, representing either 8 or 16 bits. The file header contains different information such as the width and height of the image and the maximum number of black and white shades. The information is stored in a grit format, consisting of different numbers. These numbers represent the grayscale shades of the image, ranging from black (0) to white (65.536).

More information about the PGM file format

File extension .pgm
File category Raster image
Example file Download example.pgm file (3.4 MiB)
Associated programs ACD Systems ACDSee 18
ACD System Canvas 15
Adobe Photoshop with plug-in
Corel PaintShop Pro X8
GIMP
Inkscape
Netpbm
Useful links More information about PGM files
Developer Jef Poskanzer