Portable Pixmap MIME Type

Learn what image/ppm means, how Portable Pixmap files are structured, which media type to use, and how Poly handles PPM images.

MIME type details for image/ppm

In active use
MIME typeimage/ppm
Extensions
.ppm
Magic number50 33 (P3) or 50 36 (P6)
Alternate versions
image/x-portable-pixmapimage/x-portable-anymap
First standardized1988
Created byJef Poskanzer
Browser support
Example applicationsNetpbm, GIMP
Poly supportPartial. Poly recognizes an explicitly supplied `image/ppm` type and can decode standard PPM pixels, but filename inference does not map `.ppm`, so an unlabeled upload may be classified as text or generic binary data.
Indexed by PolyPartial. A correctly classified PPM gets dimensions, filename indexing, and a visual embedding. Visible text is not OCR'd, and a misclassified `.ppm` does not receive visual indexing.
Preview in PolyPartial. A correctly classified and decodable PPM gets WebP thumbnails and opens in the image viewer. The `.ppm` extension alone does not currently select this pipeline.
Poly agentPartial. For a correctly classified PPM, the agent receives a rendered WebP thumbnail and can reason about the pixels. It does not receive comments, every image in a multi-image stream, or the original sample values.

What does image/ppm mean?

image/ppm is used by some software for a Portable Pixmap, or PPM, file. Pygame, for example, defines its SCRAP_PPM clipboard type as image/ppm for PPM-encoded image data.1 PPM is the full-color member of the Netpbm family. It stores a rectangular grid of red, green, and blue samples with no transparency and no compression. Its simplicity makes it useful as an intermediate format, a test fixture, or the output of a small graphics program. It is usually a poor delivery format because the files are large and carry almost no descriptive metadata.2

The important caveat is that image/ppm is not registered with IANA. Netpbm documents image/x-portable-pixmap as the conventional media type, while image/x-portable-anymap can describe the broader PNM family.2 The current IANA image registry has no ppm entry.3

Use image/x-portable-pixmap when you control both ends of an interchange and need the established conventional label. Use image/ppm only when an application or protocol explicitly expects it. For public web delivery, convert the image to PNG, WebP, AVIF, or JPEG instead.

The usual extension is .ppm. A generic .pnm filename can also contain PPM data, but it may instead contain PBM or PGM data, so the header is the reliable way to distinguish them.24

How a PPM file is structured

A PPM image starts with an ASCII magic identifier:

VariantMagic bytesPixel representationPractical use
Plain PPM50 33 (P3)ASCII decimal RGB samplesHuman-readable examples and debugging
Raw PPM50 36 (P6)Binary RGB samplesSmaller and faster general interchange

After the identifier come the width, height, and a maximum sample value greater than zero and below 65,536. Comments can begin with # in the header. In raw P6, each pixel is an RGB triplet. Samples use one byte when the maximum value is below 256 and two big-endian bytes otherwise. In plain P3, the same values are written as decimal ASCII separated by whitespace.2

A tiny plain PPM can therefore be written without an image library:

P3
# two pixels: red, then blue
2 1
255
255 0 0   0 0 255

PPM permits more than one image in a stream. Older software may read only the first because the format allowed only one image before July 2000. Software written before April 2000 may also assume that raw samples are always one byte because the earlier maximum value was 255.2

Do not treat a P3 header as permission to parse the entire file as harmless text. Width, height, maximum value, comments, and sample counts still need validation. A tiny header can claim enormous dimensions, and a malformed binary raster can be truncated or contain trailing images.

Why PPM exists

Jef Poskanzer created PBM as a deliberately simple interchange format in the 1980s. He distributed the Pbmplus toolkit in 1988 and added the grayscale PGM and color PPM formats by the end of that year. Netpbm replaced Pbmplus in 1993 and continues the format and tool collection today.5

That history explains PPM's design. It favors an obvious, easily generated byte layout over compression, color-management features, or rich metadata. Netpbm itself describes PPM as highly redundant but easy to write and analyze.2 This is why PPM still appears in graphics courses, ray tracers, rendering tests, Unix pipelines, and decoder fixtures even though it is uncommon as a finished asset.

Can browsers display image/ppm?

Do not rely on native browser display. MDN's current list of image types safe for ordinary web pages includes APNG, AVIF, GIF, JPEG, PNG, SVG, and WebP, but not PPM.6 Browser behavior can also depend on the declared media type and platform image services, which makes an accidental success a poor compatibility guarantee.

For a website, convert PPM to a widely supported format and send that format's registered media type. If a PPM must be downloadable, use the media type required by the receiving application and include a clear filename.

Desktop graphics tools are a better fit. Netpbm reads and writes PPM directly, while GIMP can import or export the PNM family and lets you choose ASCII or raw output for PPM.7

Support in Poly

Poly has a dedicated internal image/ppm identifier and treats it as an image when that type is already present. The image loader can decode standard PPM data, generate WebP thumbnails, extract dimensions, create a visual embedding, show the result in the image viewer, and provide a rendered thumbnail to the agent.

The current limitation is identification. Poly's filename inference table does not map .ppm, and the client MIME map gives image/ppm no default extension. A plain P3 file uploaded without a useful platform media type can be mistaken for text, while a raw P6 file can fall back to generic binary data. In either case, image thumbnails and visual indexing do not run.

When PPM is classified correctly:

  • Search includes the filename, dimensions, and visual similarity.
  • Words drawn inside the image are not OCR'd.
  • Preview and agent reading use derived 8-bit WebP pixels, not the original PPM sample stream.
  • A multi-image PPM stream should not be treated as a browsable image sequence. The normal image pipeline renders a single image.
If a .ppm upload does not receive an image preview, convert it to PNG before uploading. Renaming it to .png is not conversion because the bytes still contain PPM data.

Converting PPM to a practical format

Netpbm provides small conversion tools that work well in pipelines. For example:

pnmtopng input.ppm > output.png
jpegtopnm input.jpg > output.ppm

GIMP can also open or export PPM through its PNM support.7 Choose the destination according to the image:

  • PNG preserves pixels losslessly and supports transparency and metadata.
  • WebP or AVIF can reduce file size for web delivery.
  • JPEG is broadly compatible for photographs but introduces lossy compression.
  • PPM remains useful when the next program benefits from a trivial decoder or a streamable intermediate format.

Converting PPM to PNG is lossless when the PNG encoder preserves the represented RGB sample precision and color interpretation. Conversion does not solve every color issue, however. The PPM specification uses BT.709 transfer characteristics and D65 white, while many real-world files use sRGB or linear values without declaring that variation.2 A converter cannot recover color semantics that the producer never recorded.

PPM, PGM, PBM, PAM, and PNG

These similarly named formats solve different problems:

FormatPixelsTransparencyCompressionTypical magic identifier
PBMBlack and whiteNoNoP1 or P4
PGMGrayscaleNoNoP2 or P5
PPMRGB colorNoNoP3 or P6
PAMGeneral tuple data, including alpha-capable imagesPossibleNoP7
PNGSeveral raster color modelsYesLossless89 50 4E 47 0D 0A 1A 0A

PBM, PGM, and PPM are collectively called PNM. PAM is a later, more general Netpbm format that can represent the older visual types and additional channel layouts.4 PNG is unrelated despite the similar initials. It is normally the more practical choice for a lossless image that needs broad application and browser support.

Footnotes

  1. Pygame. pygame.scrap Clipboard Documentation.
  2. Netpbm. PPM Format Specification. 2 3 4 5 6 7
  3. Internet Assigned Numbers Authority. Media Types: image Registry.
  4. Netpbm. The PNM Format. 2
  5. Netpbm. Netpbm History.
  6. MDN Web Docs. Media Types: Image Types.
  7. GIMP Documentation. Export Image as PNM, PAM, PBM, PGM, PPM. 2
© Poly Corp. 2026