.pgm
🖼️ ImageText-based

.pgm File — Portable Graymap

image/x-portable-graymap

File Inspector

Drop any file to identify its extension and type — runs entirely in your browser

PGM

Drop a .pgm file here or click to choose

Or drop any file to identify its extension

Expected MIME type:image/x-portable-graymap

Quick Facts

Extension.pgm
Full NamePortable Graymap
MIME Typeimage/x-portable-graymap
CategoryImage
TypeText-based (human-readable)
Typical Size1 KB – 50 MB
First Appeared1988

What Is a .pgm File?

PGM (Portable Graymap) is a grayscale image format that is part of the Netpbm family of image formats. PGM files store grayscale pixel values either as ASCII text (P2 format) or raw binary (P5 format), with a simple header specifying width, height, and maximum gray value. The format supports grayscale values from 1-bit (black and white) up to 16-bit depth (65,535 shades of gray). PGM's extreme simplicity makes it one of the easiest image formats to read, write, and process programmatically, requiring no compression library or complex parsing. This simplicity has made PGM and its Netpbm siblings (PBM for bitmaps, PPM for color) popular in computer science education, image processing research, scientific computing, and Unix pipeline workflows. The ASCII variant is human-readable — you can view and edit pixel values in a text editor. PGM files can be converted to and from other formats using Netpbm tools or ImageMagick. While impractical for everyday image use due to lack of compression, PGM remains valuable in algorithmic image processing contexts.

How to Open .pgm Files

GIMP
IrfanView
XnView
ImageMagick
any Netpbm viewer
Photoshop

Related File Extensions

More Image File Extensions

Other image formats you might encounter

Browse File Extensions by Category

Explore our reference of 259 file extensions with details, programs, and related formats.