PicaJet

Reference Formats

PGM

A Netpbm raster format storing 8-bit (or 16-bit, since a 2000 extension) grayscale intensity values per pixel in plain-text or raw binary form, used as a simple portable intermediate image format.

Extension

.pgm

Full name

Portable Graymap

Introduced

1988, added to Pbmplus alongside PPM

Vendor

Jef Poskanzer / the Netpbm project

What is inside the container

A PGM file carries a short header (magic number, dimensions, maximum gray value) followed by uncompressed grayscale samples; the April 2000 extension to the Netpbm formats allowed 2 bytes per sample for a maximum value of 65535. Like its siblings, PGM has no provision for EXIF, IPTC, XMP, or ICC metadata, and no layers, transparency, or color.

How to open it

Cross-platform editor GIMP opens and exports PGM
Command line Netpbm tools and ImageMagick convert read/write PGM
Scientific computing OpenCV, MATLAB, and scikit-image commonly read/write PGM for grayscale test data
Viewers IrfanView and XnView open PGM for inspection

For archives

PGM is well suited to scientific-imaging and computer-vision working pipelines but not to DAM archival — it cannot embed provenance, rights, or descriptive metadata. Convert any PGM asset destined for long-term cataloging to TIFF or PNG so a DAM can attach and preserve the metadata it needs.

PGM followed PBM by the end of 1988, added by Jef Poskanzer to Pbmplus once it became clear that a bitonal format alone couldn’t serve grayscale imaging needs. It kept the same design philosophy — a trivially simple header plus raw samples, readable and writable by almost any tool with minimal effort — but added the tonal range needed for photographs and scientific data converted to gray levels.

In practice, PGM today survives mainly as an interchange format inside computer-vision and scientific-imaging toolchains (test datasets, sensor dumps, algorithm output) rather than as a photographic deliverable. For a DAM, that means PGM files usually arrive as intermediate artifacts from an image-processing pipeline, not as assets with their own rights or captioning needs. The practical rule is the same as for PBM and PPM: PGM is fine as a working format between tools, but a DAM should normalize it to TIFF or PNG before treating it as a catalogued, metadata-bearing asset.

Frequently asked

Can PGM carry EXIF, IPTC, or XMP metadata?

No. Like the other Netpbm formats, PGM has no provision for EXIF, IPTC, XMP, or ICC metadata, and no support for layers, transparency, or color.

What bit depths does PGM support for grayscale data?

8-bit by default, with a 2000 extension to the Netpbm formats allowing 2 bytes per sample for a maximum value of 65535, which matters when a DAM needs to preserve tonal precision from scientific-imaging sources.

Is PGM suitable as a DAM archival master?

No. PGM is well suited to scientific-imaging and computer-vision working pipelines but not to archival, since it cannot embed provenance, rights, or descriptive metadata; convert to TIFF or PNG for long-term cataloging.

What does a PGM file structurally contain?

A short header with magic number, dimensions, and maximum gray value, followed by uncompressed grayscale samples, in either plain-text or raw binary form.

Which software commonly reads and writes PGM in practice?

GIMP for general editing, Netpbm tools and ImageMagick's convert for conversion, and OpenCV, MATLAB, and scikit-image for scientific-computing and computer-vision use cases.

Does PGM support color images?

No. PGM is grayscale-only; RGB color needs PPM, its sibling format in the Netpbm family.

Why might a DAM encounter PGM files at all?

PGM commonly appears as an output or intermediate format from scientific-imaging and computer-vision pipelines, where its simple, uncompressed, tool-agnostic structure makes it easy for research software to write and read.

Is PGM compressed?

No. PGM stores uncompressed grayscale samples, which keeps file sizes larger than a comparable PNG and is another reason to convert it before long-term DAM storage.

Sources