PGM
Portable GrayMap (PGM) is a grayscale image file format used to store per-pixel brightness. It is part of the Netpbm family, which also includes PBM (bitmap) and PPM (color). PGM emphasizes simplicity, portability, and ease of parsing, making it common in teaching, research, and basic image processing tasks.
A PGM file begins with a magic number: P2 for ASCII encoding or P5 for binary encoding.
PGM records a single intensity value per pixel, with no color channels or alpha. It is uncompressed
Software support is broad; many image libraries and tools can read and write PGM files. It is
Limitations include the lack of embedded metadata beyond width, height, and maxval, no color information, and
---