1. What is the Truevision TGA Format?
The **TGA (TARGA)** format, designed by Truevision Inc. in 1984, remains one of the most reliable image specifications in real-time rendering, 3D texture mapping, and sprite creation. TGA files store raster pixels sequentially with support for color depths ranging from 8-bit grayscale to 24-bit RGB and 32-bit RGBA (BGRA).
Unlike highly compressed modern formats (like JPEG or WEBP) that introduce blocky lossy compression artifacts, uncompressed TGA maintains perfect mathematical fidelity. This makes TGA the preferred choice for normal maps, heightmaps, specular maps, and opacity masks where pixel-perfect precision is required by GPU shaders.
2. How the Offline TGA Compiler Works
This browser tool executes a 100% offline TGA compilation process in client-side RAM, ensuring absolute privacy:
- Canvas Parsing: When you drag-and-drop files, they are rendered on a virtual canvas to extract standard RGBA coordinates.
- Memory Buffer Allocation: The converter allocates a raw `ArrayBuffer` structured with an 18-byte TGA file header and the exact byte bounds needed for pixel output.
- BGR/BGRA Channel Alignment: Canvas pixels are read in RGBA, but TGA requires Blue-Green-Red (BGR) channel ordering. The compiler shifts these bytes in sequence, writing alpha parameters directly if 32-bit mode is selected.
- Top-Left Origin Descriptor: By default, TGA can store pixels starting from the bottom-left. This converter automatically sets the header's Image Descriptor byte to `0x20` (top-left origin), matching the standard coordinate space of modern graphics engines.
3. Choosing the Right TGA Depth Options
Depending on your engine requirements, select the appropriate configuration:
- 32-bit BGRA (Truecolor with Alpha): Necessary if your graphic features transparency, cutout contours, opacity gradients, or channel-packed shader layers.
- 24-bit BGR (Truecolor): Best for solid background diffuse textures. It discards alpha parameters to save 25% of file storage.
- 8-bit Grayscale: Perfect for metallic maps, roughness maps, heightmaps, and displacement channels, writing a single monochrome byte per pixel.
Frequently Asked Questions
Q: Will my images remain secure?
Yes. No file data is uploaded to any servers. The conversion, channel alignment, and binary packaging are performed inside your local browser memory sandbox.
Q: Does this converter support RLE compression?
To ensure maximum compatibility with old C/C++ game engines and asset loaders, this tool outputs uncompressed TGA streams, which compile instantly and avoid loading errors.
Q: Why do my transparent areas look black?
If you select 24-bit BGR, alpha channels are discarded. Turn on background color blending or export as 32-bit BGRA to preserve transparent regions.