Image MIME Reference
PGM
Portable Graymap
image/x-portable-graymap
VS
Portable Network Graphics (Legacy MIME)
image/x-png
PNG
A complete technical comparison of Portable Graymap and Portable Network Graphics (Legacy MIME) — covering compression, feature support, browser compatibility, magic bytes, and when to choose each format.
PNG wins on browser support
Feature Support
| Feature | PGM | PNG |
|---|---|---|
| Transparency (Alpha) | ✕ No | Yes |
| Animation Support | ✕ No | ✕ No |
| Progressive Loading | ✕ No | Yes |
| HDR Support | Yes | Yes |
| EXIF Metadata | ✕ No | Yes |
| ICC Color Profile | ✕ No | Yes |
Portable Graymap
image/x-portable-graymap
Extension
.pgm
Container
Netpbm
Compression
Uncompressed
Algorithm
None
Color Depth
8-bit (Grayscale), 16-bit (Grayscale)
Developed by
Jef Poskanzer (Netpbm Project)
Released
1988
Magic Bytes
50 32 (ASCII) or 50 35 (Binary)
Portable Network Graphics (Legacy MIME)
image/x-png
Extension
.png
Container
PNG Chunk Structure (IHDR, IDAT, IEND)
Compression
Deflate (Lossless)
Algorithm
Deflate (LZ77)
Color Depth
1-bit to 16-bit (Grayscale), 8-bit (Indexed Palette), 24-bit (True Color), 32-bit (True Color with Alpha), 48-bit (High Color), 64-bit (High Color with Alpha)
Developed by
PNG Development Group
Released
1996
Magic Bytes
89 50 4E 47 0D 0A 1A 0A
Browser Support Comparison
| Browser | PGM | PNG |
|---|---|---|
|
|
✕ |
✓ 1
|
|
|
✕ |
✓ 1
|
|
|
✕ |
✓ 1
|
|
|
✕ |
✓ 12
|
|
|
✕ |
✓
|
PGM
PGM Strengths
- Extremely simple format allows custom parsers to be written from scratch in minimal time
- Supports 16-bit precision, making it highly valuable for scientific, medical, and height-map data where 8-bit precision is insufficient
- ASCII encoding ('P2') allows manual editing and visual inspection of pixel values directly within a text editor
Limitations
- Strictly limited to grayscale; cannot display color
- Lack of compression results in massive file sizes, making it entirely impractical for web delivery or consumer storage
- Does not support alpha transparency or modern metadata structures
PNG
PNG Strengths
- The underlying format provides flawless, lossless compression and perfect 8-bit alpha channel transparency
- Universally supported by every modern operating system, image editor, and web browser
Limitations
- The 'image/x-png' string is an obsolete vendor quirk that forces backend developers to write redundant normalization logic in file upload scripts
- If left unnormalized, strict MIME validators or content security policies on modern systems may incorrectly reject valid PNG files
When to choose which format
PGM
Use PGM when…
- Computer Vision and Machine Learning Pre-processing
- Scientific and Medical Image Processing
- Unix/Linux Command-Line Image Pipelines
PNG
Use PNG when…
- Legacy Internet Explorer File Uploads
- Older ASP/PHP Web Applications
- Lossless Web Graphics