Chip in

PPM file format (.ppm)

Netpbm colour bitmap. Plain, uncompressed RGB.

Last updated

What is a PPM file?

In short: A PPM file (.ppm) is an image file in the PPM format. PPM is close to the simplest possible colour image format: a short text header giving the dimensions, then the red, green and blue value of every pixel in order. It can be converted to JPG, PNG or WEBP for free in a web browser with iHateFiles, without uploading it.

Part of the Netpbm toolkit from the late 1980s, designed so images could be passed between Unix programs as plain data.

PPM is close to the simplest possible colour image format: a short text header giving the dimensions, then the red, green and blue value of every pixel in order. There is no compression and no metadata, which is exactly the point.

What PPM is good at

  • So simple that reading one takes a few lines of code
  • Completely lossless
  • Ideal as an intermediate format between programs

Where PPM falls short

  • Very large: three bytes per pixel with no compression
  • No transparency, no metadata, no colour profile
  • Not displayed by browsers or most viewers

When to use PPM

Use PPM when writing image processing code, or when a scientific or Unix tool expects it.

How to open a PPM file

Image processing tools, scientific software, and anything in the Netpbm family.

Opening a .ppm file on each platform
WindowsIrfanView or GIMP. Windows has no built-in support for the Netpbm family.
macOSPreview will not open it. GIMP and ImageMagick will.
LinuxNative to the Unix imaging world — GIMP, ImageMagick and netpbm all read it.
PhoneNeeds a dedicated viewer.
In a browserNo browser displays PPM.

The thing that usually goes wrong

The size is the whole trade. A 12 megapixel photo is 36 MB as PPM regardless of its content.

Inside a PPM file

PPM belongs to the Netpbm family, and it is deliberately the least clever image format in existence. The header is the letters P6, a width, a height and a maximum colour value, in plain text. Then the pixels, three bytes each, in order. There is no compression, no metadata, no colour profile and no ambiguity.

That is the entire point. When you are writing an image decoder, a ray tracer or a university assignment, PPM lets you produce a viewable image with a dozen lines of code and no library at all. Generations of graphics courses have started by writing one.

It survives in Unix imaging pipelines for the same reason: it is a lossless interchange format that any tool can produce and consume without negotiation. Nobody ships PPM to a user, because a modest photograph runs to tens of megabytes.

PPM at a glance
Full namePortable Pixmap
FamilyNetpbm — PBM, PGM, PPM, PAM
Magic bytesP6 for binary, P3 for ASCII
CompressionNone
HeaderPlain text: magic, width, height, max value
Colour24-bit RGB, or 48-bit at max value 65535

Questions

What is a PPM file?

Netpbm colour bitmap. Plain, uncompressed RGB. Files use the .ppm extension.

How do I open a PPM file?

Most image software opens PPM directly. If yours does not, convert it here to something more common. It takes a few seconds and nothing is uploaded.

Can I convert PPM for free?

Yes. Every conversion here is free and unlimited, because your own device does the work rather than a server we have to pay for.

Is PPM lossless?

Yes. PPM stores every pixel exactly, at the cost of a larger file.