BMP vs PPM: technical differences
To convert BMP to PPM, drop your BMP 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.
BMP and PPM both store raw pixels, but BMP's layout is awkward for programmers: rows are usually stored bottom-up, padded to 4-byte boundaries, in BGR order, behind several possible header versions. PPM P6 is a short text header followed by top-to-bottom RGB bytes with no padding. Converting bmp to ppm keeps every pixel and makes the data far easier to read.
File size stays almost the same for a 24-bit BMP — both use about 3 bytes per pixel. Transparency, if any, is flattened onto white.
In code, the difference is striking. To read a BMP you must check the header version (BITMAPINFOHEADER, V4, V5 or the old OS/2 core header), handle 1/4/8-bit palettes, 16-bit bitfields and RLE variants, flip the row order and skip padding bytes. A P6 PPM needs you to parse four whitespace-separated header tokens and then read width × height × 3 bytes.
Palette and 16-bit BMPs are expanded to full 24-bit RGB on the way, so the PPM always has the same simple layout whatever kind of BMP you started from.
| BMP (Bitmap Image File) | PPM (Portable Pixmap (Netpbm)) | |
|---|---|---|
| Compression | Usually none (raw pixels); optional RLE for palette images | None (raw binary P6 or ASCII P3) |
| Colour depth | 1–32 bits per pixel; typically 24-bit RGB | 8 or 16 bits per channel, RGB only |
| Transparency | Rarely supported (32-bit variants only) | None |
| Animation | None | None |
| Metadata | Essentially none beyond resolution | Comment lines in the header only |
| Typical file size | Very large — width × height × 3 bytes | Very large — exactly width × height × 3 bytes plus a header |
| Support | Universal on Windows; opens almost everywhere | Image-processing libraries, Netpbm, GIMP; not browsers |
When to convert BMP to PPM
Programming and image-processing coursework
Assignments often ask you to read and write PPM. Converting BMP samples avoids writing a BMP parser.
Netpbm and ImageMagick pipelines
PPM is a standard intermediate for command-line tools and scripts.
Converting sample images for embedded or GPU experiments
When prototyping image filters on a microcontroller, FPGA or GPU, a PPM's flat RGB layout can be copied straight into a buffer. Converting BMP test images avoids writing BMP handling on constrained hardware.
What converting BMP to PPM keeps and loses
What you keep
- Exact RGB pixel values at 8 bits per channel.
- Dimensions.
What you lose
- Any alpha in 32-bit BMPs (flattened to white).
- BMP resolution field.
Our test: BMP to PPM on two real files
This pair barely changes the bytes. The 24-bit photo went from 5,760,054 to 5,760,017 bytes: the same three bytes per pixel, minus the difference between BMP's 54-byte header and PPM's 17. Its rows are 4,800 bytes, already a multiple of four, so the BMP had no padding to drop.
The 32-bit graphic shrank by a quarter, to 1,440,015 bytes, because PPM keeps only red, green and blue. Both were exact copies of what the browser decoded, including the graphic's black background: its alpha byte was treated as padding, so there was nothing to flatten onto white. Each 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 | BMP in | PPM out | Pixels vs original | Transparency | Camera EXIF | Time |
|---|---|---|---|---|---|---|
| Photo, 1600 × 1200 | 5.8 MB | 5.8 MB (same) | Identical pixels | None in source | None in source | 0.9 s |
| Graphic, 800 × 600, transparent | 1.9 MB | 1.4 MB (−25%) | Identical pixels | None in source | None in source | 1.0 s |
Last updated
Apps and sites that work with BMP and PPM
Netpbm's bmptopnm
If Netpbm is installed, bmptopnm does this conversion in a terminal and handles palette and 16-bit BMPs the same way, expanding them to full RGB. It is handy for scripting the conversion of a whole folder of test images. Its output is the same P6 layout, so files from either route work in the same program.
GIMP: P6 or P3
GIMP opens BMP and exports PPM, asking on export whether to write Raw (P6, like Pixohub) or ASCII (P3) data. Use it when an assignment insists on the plain-text variant and you would rather not use the command line. The pixel values are the same in both; only the encoding differs.
FFmpeg frame sequences
FFmpeg reads numbered PPM files as an image sequence ('-i frame%03d.ppm'), which makes PPM a convenient intermediate when frames from a BMP-producing camera or simulation need turning into a video. For example, 'ffmpeg -framerate 30 -i frame%03d.ppm out.mp4' turns a numbered set into a video, and PPM avoids the decoding problems some BMP variants cause.
Common BMP to PPM problems and fixes
Red and blue are swapped
BMP stores pixels in blue-green-red order; PPM stores red-green-blue. Code adapted from a BMP reader that still swaps channels will show blue skies as orange. In a PPM reader, take the three bytes in the order they appear. Greens stay correct, which is the giveaway that channel order, not colour management, is the problem.
The image is upside down
BMP rows normally run bottom to top, and BMP readers flip them. PPM rows run top to bottom. If your loader came from BMP code and still reverses the rows, the PPM shows upside down; remove the flip rather than flipping the file. Check by looking at text or a sky in the picture.
A black background instead of white
Pixohub flattens transparency onto white for PPM, but only when the browser sees the BMP as transparent. A 32-bit BMP with a basic header is read as opaque, so the PPM shows whatever colour hides in the transparent area, often black. Re-export the source as PNG and use PNG to PPM to get the white flattening.
Tips for better BMP to PPM results
- Python's Pillow, OpenCV and most C/C++ image libraries read P6 PPM directly; for your own reader, remember that a single whitespace byte separates the header from the pixel data.
- If you need greyscale data, convert the PPM to PGM with Netpbm or ImageMagick rather than writing a channel-averaging step yourself.
How this converter works
Pixohub decodes your BMP 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.