Image format
The PGM format
PGM is an uncompressed grayscale image format. PGM is the grayscale member of the 1988 Netpbm family, still used in computer vision datasets.
When to use PGM
Use PGM when a vision library, dataset or script expects grayscale input.
It is best for grayscale images for computer vision, OCR training and scripts, and it opens on GIMP, ImageMagick and research software — not browsers or phones.
How to open it: GIMP, ImageMagick and macOS Preview open PGM files.
| Full name | Portable Graymap |
|---|---|
| Extensions | .pgm |
| MIME type | image/x-portable-graymap |
| Introduced | 1988 |
| Compression | Uncompressed |
| Transparency | No |
| Animation | No |
| Support | Specialist format |
| Typical size | Width × height bytes for 8-bit images |
Good at
- One byte per pixel, trivially simple to read
- Supports 16-bit depth for scientific images
Not so good at
- No color
- Large and unsupported by everyday apps
The common mistake
Converting to PGM throws away color for good; converting back gives a gray picture in a color format.
Questions
What is a PGM file?
PGM (Portable Graymap) is an uncompressed grayscale image format. PGM is the grayscale member of the 1988 Netpbm family, still used in computer vision datasets.
How do I open a PGM file?
GIMP, ImageMagick and macOS Preview open PGM files.
How do I make a PGM file?
Open the Image Converter, drop your file and choose PGM. It converts in your browser, so nothing is uploaded.