Open TGA with PHP: imagecreatefromtga
Another straight to the point solution

You can use it as any other imagecreatefrom* function:
include 'tga.php';
//convert TGA to PNG
$im = imagecreatefromtga('test.tga');
imagepng($im, 'test.png');
You can also read small fraction of TGA file to get its width, height, number of bits per pixel and also check if this is a proper TGA file (inproper TGA will return zeroes):
list($width, $height, $type, $bits, $tga_type) = getimagesizetga('test1.tga');
echo 'Width: ' . $width . ' Height: '. $height;
Comments