Your best bet is to use ImageMagick. It runs on Unix and Windows (and more). To use it with PHP, you need a wrapper, which could be something as simple as this:
$input = 'uploadedfile.tga';
$output = 'myimage.jpg';
$status = /usr/local/bin/convert $input $output;
if($status) {echo "It worked!";}else{echo "Try again";}
Note that the line that begins with $status has backticks not single quotes. On a US keyboard, the back tick is on the same key as the ~ which is to the left of the 1.
For clarity, the convert program is part of the imagemagick package. There's also mogrify and info which are also very useful.