Image format

PGM converter

A .pgm file is a Portable Graymap: a single-channel greyscale image storing one intensity value per pixel, with the maximum value declared in the header. It is the middle rung of the Netpbm ladder — richer than a one-bit bitmap, simpler than a colour pixmap.

Private for supported formats — processed in your browser

Convert supported files

Runs on your device

Drop PGM files here

Batch files can each use a different output. Nothing uploads for local conversions.

Working inputs include camera RAW, browser-local audio/video, PDF, CBZ/CBR comics, office documents, ebooks, markup, 3D models, structured text, images, and archives.

Where PGM comes from

PGM arrived with Poskanzer's pbmplus toolkit in 1988 alongside PBM and PPM, and the trio has been maintained as Netpbm ever since. Its enduring niche is scientific and machine-vision work: because the file is a header followed by raw samples in a declared range, an instrument can produce it and an algorithm can consume it without either side agreeing on a codec.

How PGM works

  • P2 stores samples as whitespace-separated ASCII integers; P5 stores them as raw bytes.
  • The header declares a maximum channel value; values up to 255 use one byte per sample and values above use two, big-endian.
  • A maxval other than 255 means the samples are scaled, not clipped — a reader that ignores it produces a wrongly-exposed image.
  • There is exactly one channel, so there is no colour information and no alpha.
  • As across Netpbm, header whitespace is free-form and # introduces comments.

When to use PGM

  • Machine vision and image-processing pipelines that operate on intensity alone
  • Depth maps, height fields and other single-channel scientific data
  • Instrument output where a declared sample range matters more than file size
  • Intermediate storage between processing stages, where re-encoding would be lossy

Strengths and limitations

Strengths

  • Raw samples in a declared range — no codec, no colour management, nothing to misinterpret
  • Supports 16-bit depth, which most consumer formats do not
  • Trivial to read and write in any language

Limitations

  • Uncompressed, so files are large relative to PNG for the same data
  • Greyscale only
  • No browser or common viewer support
  • The maxval scaling rule is routinely ignored, producing silently wrong brightness

Compatibility

Standard in scientific and machine-vision toolchains — OpenCV, ImageMagick, MATLAB and Netpbm all read it — and absent from consumer software and browsers. Novus Convert decodes both ASCII and binary PGM locally, honours the declared maximum value when scaling to 8-bit output, and converts to the standard raster formats.

None beyond header comments. No colour profile, no EXIF, no acquisition metadata — anything an instrument recorded alongside the pixels has to travel in a separate file.