What is a PPM File?

A PPM (Portable Pixel Map, also called portable pixmap) file is the Netpbm color image format: an uncompressed grid of red, green, and blue samples behind a short text header. Its binary (P6) and plain text (P3) variants favor easy parsing over compactness.

How PPM Files work

A PPM image is a text header followed by a raster. The header holds the magic number, then the width, height, and maximum sample value (maxval, from 1 to 65535) as ASCII decimal numbers separated by whitespace; # starts a comment. In the usual raw variant (P6), a single whitespace character ends the header and the raster follows as rows from top to bottom, each pixel as a red, a green, and a blue sample: one byte each when maxval is below 256, otherwise two bytes with the most significant first. The plain variant (P3) writes each sample as an ASCII decimal number instead. Nothing is compressed, so a raw 1920 × 1080 image at maxval 255 occupies 6,220,800 bytes plus the header. Netpbm calls PPM a lowest common denominator color format and “egregiously inefficient”, and says that being very easy to write programs for is the point.

Key facts

  1. Write raw P6 unless a person needs to read the file. Netpbm calls plain P3 fairly rare, and for the widest compatibility it recommends a minimal subset: P6, a newline, width and height separated by a space, a newline, a maxval of at most 255, a newline, then the raster, with only one image in the file. A raw PPM file may legally contain several images in sequence, but Netpbm warns that most tools read only the first.
  2. Maxval sets both the scale and the byte width of every sample. Values run from 0 to maxval, which can be anything from 1 to 65535, and raw files switch from one byte per sample to two big-endian bytes at maxval 256. A reader that hard-codes 8-bit channels misreads a valid 16-bit file, and one that ignores maxval gets the brightness wrong. Netpbm notes that raw files were limited to 255 before April 2000 and that old programs may depend on that.
  3. Color meaning is specified but not recorded in the file. True PPM samples are BT.709 red, green, and blue with the BT.709 gamma transfer function, and maxval on all three channels is D65 white. The specification itself notes that files commonly substitute sRGB or store linear samples; the header has no field to say which and no place for an ICC profile, so agree on the interpretation with whoever produces the files. Netpbm’s pnmgamma converts between these variants.
  4. PPM has no alpha channel: every pixel is exactly three samples. Netpbm keeps transparency in a separate PGM file used as a transparency mask, or in its PAM format with the RGB_ALPHA tuple type, so converting an image with transparency to PPM drops the alpha unless it is exported separately.

When PPM Files matter

Use PPM for uncomplicated image conversion, inspection, or debugging when decoder simplicity is useful. Convert it before delivery when its relatively large size would waste storage or network bandwidth.

How Transloadit helps with PPM Files

Transloadit’s image formats table lists PPM as a format its ImageMagick-based Robots, including /image/resize, can read and write, so a PPM file can be converted to a compressed format such as PNG or JPEG in a Step.

The table reports what each stack can read and write. It does not say how 16-bit samples or the color variants of PPM are interpreted, and no Assembly was run for this entry.

Explore Transloadit’s file formats & compression capabilities

Sources

Turn media knowledge into a working pipeline

Connect uploads, processing, AI, storage, and delivery through one declarative API — with the encoding stack, scaling, and format churn handled for you.

Try Transloadit for free