pngtoolskit.org
PNG and image utilities, in the browser
Say hi →

PPM to PNG

P6 · P5 · P4 binary · P3 · P2 · P1 ASCII · P7 PAM · 16-bit · batch

Nothing opens a .ppm. Not your image viewer, not your browser, not the thing you were about to paste it into — the format predates the idea that anyone but a program would want to look at it. This reads all seven Netpbm variants and hands you a PNG.

Drop Netpbm files here

.ppm, .pgm, .pbm, .pnm, .pam — multiple files allowed

    no files
    Ready.

    What it reads

    All six of the classic magic numbers, plus PAM. The label under each result says which one your file turned out to be, along with its bit depth and maximum value — useful on its own when you have a file and no idea what wrote it.

    The details that break other readers

    Netpbm looks like it can be parsed with three calls to readline, and it cannot. Three things in the specification bite:

    16-bit samples are big-endian and are scaled down to 8-bit for the PNG, since a canvas is 8-bit per channel. A maximum value that is not 255 — 15, 1023, 4095 — is scaled properly rather than clipped, which is the other common way a converted PGM comes out almost black.

    Errors you might see

    Every file is decoded on its own, so one bad file in a batch does not stop the rest, and the status line names it. Truncated means the header promises more pixels than the file contains — usually a partial download or a pipe that was cut off; the numbers tell you how much arrived. Not a Netpbm file means the first token is not one of the magic numbers, which most often means the extension is wrong.

    Privacy

    100% client-side. The file is decoded and re-encoded in your browser; nothing is uploaded.

    Related tools