{"id":"image-x-portable-pixmap","mimeType":"image/x-portable-pixmap","name":"Portable Pixmap","shortName":"PPM","category":"Raster Graphics","extensions":[".ppm"],"description":"The image/x-portable-pixmap MIME type represents the Portable Pixmap (PPM) format, the color imaging member of the Netpbm family of formats. Created by Jef Poskanzer in the late 1980s, PPM is an uncompressed, highly simplified raster image format that stores pixel data as RGB (Red, Green, Blue) color triplets. It features two encoding variants: a human-readable ASCII plaintext version (designated by the 'P3' magic number) where pixel values are written as readable text integers, and a more compact raw binary version ('P6'). Because of its extreme structural simplicity, it is widely used as a lowest-common-denominator intermediary format for image conversion pipelines and academic computer graphics programming.","seo":{"title":"image/x-portable-pixmap MIME Type | Developer Reference for PPM","description":"Complete reference for the image/x-portable-pixmap MIME type: Portable Pixmap (PPM), Netpbm RGB color formats, P3 and P6 magic bytes, and image processing.","faqs":[{"question":"What is a PPM file?","answer":"A PPM (Portable Pixmap) file is an uncompressed RGB color image format. Part of the Netpbm suite, it represents pixels using red, green, and blue values without any compression, making it very easy to read and write programmatically."},{"question":"What is the difference between PPM, PGM, and PBM?","answer":"They are all part of the Netpbm family. PBM (Portable Bitmap) is strictly 1-bit black and white. PGM (Portable Graymap) is grayscale. PPM (Portable Pixmap) supports full RGB color. Each uses different magic numbers in their file headers to identify themselves."},{"question":"Why are PPM files so large?","answer":"PPM files do not use any form of data compression. Every single pixel requires 3 bytes (for 24-bit color) or 6 bytes (for 48-bit color) of storage. This results in massive file sizes compared to modern compressed formats like JPEG or PNG."}]},"index":{"compression":["Uncompressed"],"browserSupport":{"score":1,"label":"None"},"commonUses":["Intermediary Format for Image Format Conversion","Academic Computer Graphics and Raytracing Output","Unix/Linux Command-Line Image Pipelines"]},"technical":{"magicBytes":{"hex":"50 33 (ASCII) or 50 36 (Binary)","ascii":"P3 or P6"},"container":"Netpbm","compressionAlgorithm":["None"],"colorDepth":["24-bit (RGB)","48-bit (RGB High Color)"],"transparency":false,"animation":false,"metadata":{"exif":false,"xmp":false,"iccProfile":false},"alphaChannel":false,"progressiveLoading":false,"hdrSupport":true},"history":{"developer":"Jef Poskanzer (Netpbm Project)","released":"1988","specification":"Netpbm PPM Format Specification"},"browserSupport":{"chrome":false,"chromeVersion":"None","firefox":false,"firefoxVersion":"None","safari":false,"safariVersion":"None","edge":false,"edgeVersion":"None","internetExplorer":false},"softwareSupport":[{"name":"Netpbm (Command-line tools)","logo":""},{"name":"ImageMagick","logo":"image-magic.webp"},{"name":"GIMP","logo":"gimp.svg"},{"name":"XnView","logo":""}],"conversion":{"convertTo":["png","jpeg","tiff"],"convertFrom":["png","jpeg","tiff","bmp"]},"developer":{"httpHeaders":[{"header":"Content-Type","value":"image/x-portable-pixmap"}],"htmlAccept":"image/x-portable-pixmap, .ppm","fileDetection":["A PPM file always begins with a 2-byte magic number starting with 'P' (Hex: 50).","The second byte determines the encoding: '3' (Hex: 33) for plain ASCII text, and '6' (Hex: 36) for raw binary.","Following the magic bytes are whitespace-separated ASCII numbers defining the image's width, height, and the maximum color value for each RGB channel (usually 255 for 24-bit color, or 65535 for 48-bit color)."]},"prosCons":{"pros":["Absolute structural simplicity allows parsers and renderers (such as custom raytracers) to write directly to the format with virtually no overhead or external libraries","Supports 16-bit per channel (48-bit total) precision, preserving deep color accuracy before converting to final delivery formats","ASCII encoding ('P3') allows manual editing and visual inspection of RGB values directly within a text editor"],"cons":["Zero compression results in astronomical file sizes, making it entirely impractical for web delivery or consumer storage","Does not natively support an alpha channel for transparency (this is handled by the newer PAM extension format within the Netpbm suite)","Lacks support for modern metadata standards like EXIF, XMP, or embedded ICC color profiles"]},"specifications":{"url":"https://netpbm.sourceforge.net/doc/ppm.html","rfc":"","mimeAliases":["image/ppm"]},"developerSnippets":{"python":"import magic\n# Libmagic natively detects PPM files and correctly identifies them based on the P3/P6 signature\nprint(magic.from_file('render.ppm', mime=True)) # Outputs 'image/x-portable-pixmap'","nodejs":"const fs = require('fs');\n// Manually checking the PPM magic bytes (P3 or P6)\nconst buffer = Buffer.alloc(2);\nconst fd = fs.openSync('render.ppm', 'r');\nfs.readSync(fd, buffer, 0, 2, 0);\nfs.closeSync(fd);\nconst isPPM = buffer[0] === 0x50 \u0026\u0026 (buffer[1] === 0x33 || buffer[1] === 0x36);\nconsole.log('Is Portable Pixmap (PPM):', isPPM);","go":"import (\n    \"bytes\"\n    \"net/http\"\n)\n// Native Go HTTP detection does not recognize PPM natively.\n// Check directly for the P3 or P6 signatures:\n// isPPM := len(buf) \u003e= 2 \u0026\u0026 buf[0] == 'P' \u0026\u0026 (buf[1] == '3' || buf[1] == '6')","php":"$mime = mime_content_type('render.ppm');\necho $mime; // Standard PHP setups typically return 'image/x-portable-pixmap'"},"relatedFormats":["png"]}
