You might want to consider Calling a C API in a dll from Perl on Windows (and perhaps some related recent threads). If applicable, and if PhotoShop does png and tga, you may be able to let Photoshop do the work, under perl's direction.
Comment on Re: Convert PSD (photoshop) to TGA and/or PNG?