PGM to PNG Converter
Turn a Netpbm graymap into a PNG that every browser shows.
or drop files here
PGM Format
Portable Graymap
The grayscale member of the Netpbm family of formats. Each pixel is a gray value, stored as plain text or in a binary form.
- grayscale only
- 8-bit or 16-bit samples
- plain text or binary encoding
- part of Netpbm
PNG Format
Portable Network Graphics
A lossless raster image format developed in the mid-1990s as a patent-free replacement for GIF and standardized as ISO/IEC 15948 and a W3C Recommendation.
- lossless compression
- alpha transparency
- 8-bit and 16-bit channels
- supported by every browser
How to convert PGM to PNG
Follow these steps to convert PGM to PNG online.
Choose your PGM file, or several at once.
Wait while the converter turns each file into PNG.
Download each new PNG file. Your original file isn't changed.
Related Tools
PGM to PGM
Convert PGM to PGM format
PGM to PPM
Convert PGM to PPM format
PGM to RGB
Convert PGM to RGB format
PGM to TGA
Convert PGM to TGA format
PGM to TIF
Convert PGM to TIF format
PGM to TIFF
Convert PGM to TIFF format
PGM to WebP
Convert PGM to WebP format
PGM to XBM
Convert PGM to XBM format
AVIF to PNG
Convert AVIF images to PNG
BIN to PNG
Recover a picture saved as a .bin file, such as an Outlook ATT00001.bin attachment or a browser download, as a PNG. Firmware, CD images and other binary files aren't pictures and can't be converted.
CSV to PNG
Convert CSV to PNG format
CUR to PNG
Convert CUR images to PNG format
DOT to PNG
Convert DOT to PNG: your Graphviz graph laid out by Graphviz itself, in your browser, on a white background. Pictures and links the graph names aren't loaded.
EXR to PNG
Convert EXR to PNG format
HEIF to PNG
Convert HEIF images to PNG format
ICNS to PNG
Convert ICNS to PNG format
JPEG to PNG
Convert JPEG to PNG format
JPG to PNG
Convert JPG to PNG with transparency
KTX2 to PNG
Convert KTX2 to PNG format
Markdown to PNG
Convert Markdown to PNG online
NEF to PNG
Convert NEF to PNG format
PPT to PNG
Convert PPT to PNG format
PSD to PNG
Convert PSD images to PNG format
SVG to PNG
Convert SVG files to PNG format
What to know before converting PGM to PNG
- Plain (P2) and raw (P5) graymaps are both accepted.
- A PGM deeper than eight bits a sample comes out with eight.
- A PGM that holds an opacity mask becomes a gray picture, not transparency.
- Each file you choose becomes its own PNG.
About PGM files
What is a PGM file?
PGM stands for Portable Gray Map. It is the grayscale member of the Netpbm family and stores one gray value for each pixel. A raw PGM begins with P5 and keeps its samples in binary form. A plain PGM begins with P2 and writes each sample as decimal text. When the Maxval in the header is above 255, every raw sample takes two bytes.
Netpbm also uses PGM for opacity masks, with a different reading of the sample values. The conventional media type is image/x-portable-graymap, which IANA has not registered. People meet PGM in image-processing experiments and in grayscale image interchange.
Programs that open PGM files
Windows, Mac and Linux
- ImageMagick: reads and writes the PGM member of the Netpbm family.
- Netpbm: provides programs and libnetpbm for processing graymaps.
PGM and PNG compared
- Content: a PGM holds gray samples and nothing else. A PNG can hold gray, color and an alpha channel.
- Encoding: PGM is either plain text or binary. PNG compresses its data without loss.
- Depth: a raw PGM uses one byte per sample up to a Maxval of 255 and two bytes above it. PNG allows 8-bit and 16-bit channels.
- Reach: every browser supports PNG, while PGM belongs to image tools.
Here a PGM goes through ImageMagick in your browser and comes out as a PNG. The step adds no filter, and it writes eight bits per sample.
Other ways to convert PGM to PNG
- Netpbm: run pnmtopng measurement.pgm > measurement.png. The program maps the file's maximum value to a PNG depth.
- ImageMagick: run magick measurement.pgm review.png.
- GIMP: use File > Export As, add .png to the file name and confirm with Export. GIMP's PNM reader loads plain and raw files, and the export dialog that follows offers PNG options.
Problems with PGM files
- A program rejects the file: older readers may refuse samples deeper than eight bits. The pamdepth program from Netpbm can reduce the Maxval.
- Only the first image shows: some readers stop after one image, although a raw PGM may hold a sequence.
- The grays look wrong: linear-light and sRGB variants can display differently from the BT.709 reading the specification describes.
Frequently Asked Questions
Everything you need to know about our converter
Why won't my PGM open in a browser or photo app?
Does the page read both P2 and P5 files?
What happens to a 16-bit PGM?
Do my gray values change?
Is a PGM mask the same as a picture?
Does the file get uploaded?
How big can the image be?
Can I convert several PGM files at once?
Browse All Tools
Browse by category instead of one giant mixed list.
Convert Tools
Convert image, audio, video, document, and data files directly in your browser.