Reads P1–P6 (plain and raw PBM, PGM, PPM), P7 PAM with alpha, and PFM floating-point images. 16-bit files can be saved as 16-bit PNGs, and files holding several images get a page menu.

How to convert PPM, PGM and PBM to PNG

  1. Drop one or more .ppm, .pgm, .pbm, .pnm, .pam or .pfm files onto the box above, or click it to choose files.
  2. Each image gets a card with a preview, its Netpbm type, dimensions and bit depth.
  3. For 16-bit or floating-point images, choose whether to keep full precision in a 16-bit PNG or save a standard 8-bit PNG. Scale up small bitmaps if you need them bigger.
  4. Click Download PNG on a card, or Download all as ZIP to save everything at once.

The output always uses the smallest matching PNG type: PBM bitmaps become 1-bit black-and-white PNGs, PGM files become grayscale PNGs, and PAM files with an alpha channel keep their transparency.

Supported Netpbm formats

Magic numberFormatContents
P1 / P4PBM, plain / raw1-bit black and white bitmaps
P2 / P5PGM, plain / rawGrayscale, 8-bit or 16-bit (maxval up to 65535)
P3 / P6PPM, plain / rawRGB color, 8-bit or 16-bit per channel
P7PAMGrayscale, RGB, or either with alpha; black and white
Pf / PFPFM32-bit floating-point grayscale or RGB (HDR)

Comments, unusual whitespace and non-standard maxvals such as 1023 or 4095 are handled correctly. Files that contain several images back to back, which Netpbm tools allow, show every image in the page menu.

Tips for Netpbm files

Keeping 16-bit precision

Scanners, cameras and scientific tools often write 16-bit PGM or PPM files. Leave PNG bit depth on 16-bit to keep every level of the original. Choose 8-bit only if the PNG is headed for the web, where 16-bit adds file size without visible benefit.

Viewing PFM HDR images

PFM stores linear light, often with values above 1.0. Apply sRGB gamma makes it look right on screen, and Range: Fit to brightest pixel brings overexposed renders back into view.

Tiny PBM icons and test images

Use Scale to enlarge small bitmaps with crisp pixel edges instead of blur.

Working with other legacy formats? Try the PCX to PNG converter, the TGA to PNG converter or the SGI to PNG converter.

PNM to PNG FAQ

What is a PNM file?

PNM (portable anymap) is the umbrella name for the Netpbm image formats: PBM for black and white, PGM for grayscale and PPM for color. They are deliberately simple uncompressed formats, used heavily in image processing, computer vision courses and Linux command-line tools.

Are my files uploaded anywhere?

No. The files are read and converted by JavaScript in your browser tab. Nothing is sent to a server, and the tool keeps working offline once the page has loaded.

What's the difference between P3 and P6?

They hold the same kind of image. P3 is "plain" PPM, where every value is written as text, and P6 is "raw" PPM, where values are stored as bytes. P1/P4 and P2/P5 differ in the same way. This converter reads both.

Does it keep 16-bit depth?

Yes. PGM, PPM and PAM files with a maxval above 255 can be exported as 16-bit PNGs with full precision. Non-standard maxvals are rescaled to the full 16-bit range so the brightness stays correct.

Can I convert many files at once?

Yes. Drop as many files as you like, then use Download all as ZIP to get every converted PNG in one archive, each with the settings you picked for it.

Does it support PAM and PFM?

Yes. PAM (P7) files are read with their TUPLTYPE, including alpha channels. PFM floating-point files are read in either byte order and flipped the right way up, since PFM stores rows bottom to top.

Why is PNG so much smaller than my PPM?

Netpbm formats are uncompressed, so a PPM stores 3 bytes for every pixel no matter what. PNG compresses losslessly, so the image is identical but usually several times smaller.

My file won't open. What's wrong?

The card will say why. Common causes are a file that was cut short, which still converts with the missing rows shown in black, and files that only use a .pnm extension but actually hold another format.

Converter Capabilities

  • Supports P1–P6 (ASCII & binary): PBM, PGM, PPM

  • Handles comments (# ...), arbitrary whitespace, and maxval up to 65535 (scaled to 8-bit PNG)

  • Multi-file queue with previews + per-file Download PNG

  • Export All as ZIP (in-browser ZIP writer, no dependencies)

PNM to PNG Tool FAQ

  • Which PNM formats are supported?
    This tool supports PBM (bitmap), PGM (grayscale), and PPM (pixmap) in both ASCII (P1–P3) and binary/raw (P4–P6) encodings.
  • Does it handle large maxval values (like 65535)?
    Yes. Pixel values greater than 255 are scaled down to 8-bit per channel for PNG export.
  • Is the conversion private?
    Yes. All conversions happen locally in your browser. No files are uploaded or stored on servers.
  • Can I batch convert multiple files?
    Yes. You can select multiple PNM files and use the “Export All as ZIP” option to download all PNGs at once.
  • Why convert PNM to PNG?
    PNG is a modern, compressed, and widely supported format. Converting legacy Netpbm images to PNG makes them easier to view, share, and edit with modern software.

Our Full Image Tool Library

Flipper File