JPG vs PPM: technical differences
To convert JPG to PPM, drop your JPG file into the converter above and download the PPM: the plain, uncompressed Netpbm format that image-processing scripts read. It is free, needs no sign-up, and runs in your browser, so the file is never uploaded.
PPM is a teaching and tooling format: P6, the width and height, the maximum value 255, then raw RGB bytes in reading order. Converting a JPG means running the JPEG decoder once so your own program never has to. The output size is exactly width × height × 3 bytes plus the short header — 921,600 bytes of pixels for a 640×480 photo.
No information is lost in the conversion beyond metadata; you get the same 8-bit values a standard JPEG decoder would produce, with EXIF orientation applied so the image is upright. Note that different JPEG decoders can produce values that differ by a level or two, so comparisons with other tools may not match bit for bit.
| JPG (JPEG (Joint Photographic Experts Group)) | PPM (Portable Pixmap (Netpbm)) | |
|---|---|---|
| Compression | Lossy (8×8 DCT blocks, quantisation, chroma subsampling) | None (raw binary P6 or ASCII P3) |
| Colour depth | 8 bits per channel; RGB/YCbCr, greyscale or CMYK | 8 or 16 bits per channel, RGB only |
| Transparency | None | None |
| Animation | None | None |
| Metadata | EXIF, IPTC, XMP, ICC profile | Comment lines in the header only |
| Typical file size | Smallest of the classic formats for photos | Very large — exactly width × height × 3 bytes plus a header |
| Support | Universal — every browser, camera and device | Image-processing libraries, Netpbm, GIMP; not browsers |
When to convert JPG to PPM
Image-processing homework that only reads PPM
Assignments in courses on computer graphics or vision commonly provide a PPM reader and ask you to implement filters. Converting your own JPG photos lets you test on real-world images rather than only the sample files.
Ground-truth inputs for comparing algorithms
Researchers comparing compression or denoising algorithms decode a JPG once to PPM so every algorithm starts from the identical raw pixels, with no decoder in the loop.
Embedded and retro projects
Hobby projects on minimal systems sometimes stream raw RGB data to a framebuffer. PPM's header is trivial to skip, leaving the exact bytes you need.
What converting JPG to PPM keeps and loses
What you keep
- The decoded RGB values, exactly, at 8 bits per channel.
- Pixel dimensions and upright orientation.
What you lose
- JPG compression — the PPM is typically 10–20 times larger.
- All EXIF, GPS, IPTC and ICC data; PPM has no metadata fields beyond comments.
Our test: JPG to PPM on two real files
Both PPMs held exactly the pixels Chromium decoded from the JPG. With 3 bytes per pixel and a text header of 17 bytes for the photo and 15 for the graphic, they came to 5,760,017 and 1,440,015 bytes: 13.5 and 33 times the JPGs. The graphic grew far more because its JPG was only 43 KB.
Our test JPG has no colour profile, so these are the decoder's own values; a JPG with a profile would be converted to sRGB first. Both conversions took under a second.
Method: this converter in Chromium (Playwright 1.64.1) on an Apple M2 Mac, default 85% quality for lossy output. The photo is an iPhone 14 Pro Max shot scaled to 1600 × 1200, metadata intact; the graphic has a transparent background, soft shadow, gradients and text. SSIM and PSNR compare each result with the decoded original on white (how we test).
| Test file | JPG in | PPM out | Pixels vs original | Transparency | Camera EXIF | Time |
|---|---|---|---|---|---|---|
| Photo, 1600 × 1200 | 425 KB | 5.8 MB (14× larger) | Identical pixels | None in source | Removed | 0.9 s |
| Graphic, 800 × 600, transparent | 43 KB | 1.4 MB (33× larger) | Identical pixels | None in source | None in source | 0.9 s |
Last updated
Apps and sites that work with JPG and PPM
Decoding a JPG in your own program
libjpeg's djpeg tool writes PPM by default and Netpbm's jpegtopnm does the same, so on a lab machine with either installed this conversion is one command. Pillow and OpenCV can read the JPG directly, which is fine unless the assignment's point is to avoid a JPEG decoder.
Libraries that read the result
stb_image reads binary PPM, as do OpenCV's imread, Pillow and MATLAB. FFmpeg reads and writes PPM frames too, which is handy when building test video from stills. Because the format is so simple, a reader takes a few dozen lines of C, which is why course starter code often includes one.
Inspecting the output
GIMP and IrfanView open PPM, and a hex viewer shows the header in plain text. Windows Photos and most phone galleries do not, so test the file in the program you are actually writing. Opening it in a text editor shows the header followed by unreadable binary.
Common JPG to PPM problems and fixes
Values differ from Pillow's or OpenCV's decode
In our test Chromium's decode matched Pillow's exactly, but the JPEG standard lets decoders differ slightly in how they reconstruct and upsample colour, so other tools or settings can disagree by a level or two in some pixels. If two programs' results must agree bit for bit, decode once and have both read the same PPM.
Portrait photos are rotated compared with your other tools
Pixohub applies the EXIF orientation, so the PPM is upright and its width and height are swapped for a portrait phone photo. Pillow and OpenCV's IMREAD_UNCHANGED may give you the sensor's sideways layout instead. Decide which layout your experiment expects and stick to one source; mixing the two in one dataset gives inconsistent shapes.
The dataset becomes enormous
PPM is 13 to 33 times larger than the JPGs in our test. A folder of 1,000 phone photos converted at full size runs to tens of gigabytes. Resize to the resolution your algorithm needs with the image resizer first, or decode in your own code with a library and keep the JPGs on disk.
Tips for better JPG to PPM results
- Downscale large camera photos with the image resizer before converting — a 12 MP photo becomes a 36 MB PPM.
- If your loader breaks, check that it handles the single whitespace byte after the header's 255 before the binary data begins.
How this converter works
Pixohub decodes your JPG and encodes the PPM entirely inside your browser. Nothing is uploaded, so the conversion is private by design and as fast as your device.
Need more? Shrink the result with the image compressor, change its dimensions with the image resizer, or convert a whole folder at once with bulk format convert.