Targa (TGA) converter
Convert Targa .tga textures, renders and game screenshots to PNG or JPG. Alpha, palettes, RLE compression and bottom-up row order are handled.
.tga · .targa
Format
About Targa (TGA)
TGA, or Truevision TGA, is a raster format from 1984 that is still everywhere in games and 3D work. Its header is 18 bytes of plain numbers: an optional image-ID text, an optional colour map, the image type (colour-mapped, true-colour or grayscale, each with or without run-length encoding), width, height, bits per pixel and a descriptor byte with the alpha depth and the row origin. Version 2 files add a 26-byte footer ending in TRUEVISION-XFILE plus an extension area for author, date, gamma and a postage-stamp thumbnail. Version 1 files have no footer and no signature at all.
The format lasts because it is trivial to read and write and keeps a clean 8-bit alpha channel. Game engines, mod tools, Blender, 3ds Max, Substance and many older pipelines import and export it, and texture packs, character skins, sprays and render passes are often delivered as .tga. Outside that world almost nothing displays it: browsers, chat apps and office documents need PNG or JPG.
Our image engine reads uncompressed and RLE TGA in 8-bit colour-mapped, 8-bit grayscale, 16-bit, 24-bit and 32-bit forms, and follows the origin bits, including right-to-left files. A 2,801,531-byte RLE texture became a 1,110,647-byte PNG, because deflate compresses textures far better than TGA's run-length scheme. PNG keeps alpha and palettes exactly; JPG drops alpha onto a background colour and cuts the same texture to 189,026 bytes.
Two TGA habits cause most surprises. Rows are stored bottom-up by default, so programs that ignore the origin flag show the picture upside down. And some exporters write 32-bit files with every alpha value at 0, meaning no alpha, while others mean fully transparent; we currently treat zeros as transparent, so such a file converts to an empty PNG or a white JPG.
Common Targa (TGA) problems
A texture needs to be shown on a website, forum or mod page.
Use /convert/tga-to-png to keep alpha, or /convert/tga-to-jpg for a much smaller preview of an opaque render.
The TGA appears upside down in another program.
That program ignores the origin flag. Converting with /convert/tga-to-png writes the rows upright, and PNG has no origin flag to misread.
The converted PNG is completely transparent.
The TGA's alpha channel is all zeros. Remove the alpha channel in an image editor, then convert again.
A sprite or particle texture gets a grey halo as JPG.
Set background to #000000 in /convert/tga-to-jpg; sprites drawn for additive blending are meant to sit on black.