TGA vs PPM: technical differences
To convert TGA to PPM, drop your TGA 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.
Both formats are raw-pixel formats at heart, which makes this one of the simplest conversions possible. A 24-bit TGA stores BGR bytes, usually bottom row first, after an 18-byte binary header. A P6 PPM stores RGB bytes top row first after a short text header. Pixohub handles the byte order and row order for you, reading the TGA's origin flag so the PPM comes out upright.
The difference that matters is alpha. PPM has none, so 32-bit TGAs are blended onto white. For 24-bit files, the pixel data is identical and the file size is essentially unchanged: width × height × 3 bytes in both cases, plus each format's header.
Input must be true-colour TGA (24/32-bit, raw or RLE). The PPM output is 8-bit binary P6 with maxval 255 and no comments, so it's easy to read from your own code.
| TGA (Truevision TGA (Targa)) | PPM (Portable Pixmap (Netpbm)) | |
|---|---|---|
| Compression | None or lossless RLE | None (raw binary P6 or ASCII P3) |
| Colour depth | 8, 16, 24 or 32 bits per pixel | 8 or 16 bits per channel, RGB only |
| Transparency | 8-bit alpha in 32-bit files | None |
| Animation | None | None |
| Metadata | Optional image ID and extension area | Comment lines in the header only |
| Typical file size | Large — close to raw pixel size | Very large — exactly width × height × 3 bytes plus a header |
| Support | Game engines, 3D and video tools; browsers cannot display it | Image-processing libraries, Netpbm, GIMP; not browsers |
When to convert TGA to PPM
Graphics coursework
Assignments that ask you to write a PPM reader, or to run filters on PPM input, become easier to test with real images. Game textures and screenshots in TGA give you varied, colourful test data.
Netpbm pipelines
Netpbm has its own tgatoppm converter, but if you don't have it installed (on Windows, for example), this does the same job in the browser before you pipe the result into pnmscale or pnmquant.
Debugging a TGA loader
If you're writing your own TGA decoder, a PPM converted here makes a handy known-good reference to diff your output against byte for byte, after accounting for the white alpha flattening on 32-bit files.
What converting TGA to PPM keeps and loses
What you keep
- Exact RGB values of opaque pixels.
- Resolution, with rows written top-down in correct orientation.
What you lose
- The alpha channel. Transparent pixels are blended onto white.
- TGA image ID and extension-area metadata.
- RLE compression, if the TGA used it.
Our test: TGA to PPM on two real files
For the 24-bit photo, TGA and PPM held the same pixels in almost the same bytes: 5,760,044 in, 5,760,017 out, identical. The 27-byte saving is the TGA's 18-byte header plus a 26-byte image ID, replaced by PPM's 17-byte text header.
The 32-bit graphic dropped from 1.9 MB to 1.4 MB because PPM has no alpha: transparent pixels were blended onto white, and the result was identical to the TGA viewed on white. Each conversion took about 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 | TGA 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 | 1.1 s |
| Graphic, 800 × 600, transparent | 1.9 MB | 1.4 MB (−25%) | Identical pixels | Flattened onto white | None in source | 0.9 s |
Last updated
Apps and sites that work with TGA and PPM
OpenCV reads PPM but not TGA
OpenCV's imread handles PPM, PNG, BMP and others but not TGA, so computer-vision code that has to process game screenshots or textures needs them converted first. The PPM loads with no extra libraries. Pillow could bridge the gap, but converting once keeps a C++ or Python script dependency-free.
Pillow and stb_image
Python's Pillow and the single-header stb_image library read both formats, so for them the conversion is only worth it when an assignment or test harness specifically requires PPM. Both return a 32-bit TGA's alpha as a fourth channel, which the PPM won't have.
Viewers for both
GIMP, IrfanView and XnView open TGA and PPM, so you can check the two files side by side. Windows Photos and browsers open neither. They also show image dimensions and bit depth, which helps when you check a decoder's output against the original file.
Common TGA to PPM problems and fixes
Your TGA decoder's output is flipped
If your own decoder's output differs from this PPM by being upside down, it ignores bit 5 of the TGA header's descriptor byte (byte 17). Bottom-up files leave it clear, top-down files set it. Pixohub applies it and writes the PPM top row first. Testing your decoder on both bottom-up and top-down files catches this early.
Your decoder's pixels are offset
Byte 0 of a TGA header gives the length of an optional image ID that sits between the header and the pixels. Our test TGA had a 26-byte ID. A decoder that starts reading at byte 18 regardless shifts the whole image and garbles colours; skip 18 + ID length bytes.
Colours swapped against the PPM
TGA stores blue-green-red, PPM red-green-blue. If your decoder's output has red and blue exchanged compared with Pixohub's PPM, it is copying TGA bytes in file order. Reorder the channels when reading. Pixohub's own reader does exactly that swap when loading the TGA, so the PPM is the reference to check against.
Tips for better TGA to PPM results
- Comparing against your own decoder? Use 24-bit TGAs, so white-flattening of alpha doesn't create differences.
- If you need the alpha too, convert the TGA to PNG as well and read the alpha from that.
How this converter works
Pixohub decodes your TGA and encodes the PPM entirely inside your browser, using a bundled TGA decoder because browsers cannot open TGA natively. 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.