简体   繁体   中英

How to convert a JPG image to TGA with PHP (preferably in CodeIgniter)?

We're developing a website and for a particular section user is uploading images. User can upload a jpg file, which on upload we need to convert it to TGA format.

Is there any PHP or CI library which can do this? I know this is not possible with GD library or PHP image magic.

Thanks for any help.

Cheers

You can do that with PHP imagemagick's setImageFormat !

And imagemagick support TGA (Read, Write).

From the comments:

<?php
        $image = new Imagick();

        $image->setResolution(300, 300);
        $image->readImageBlob(...);
        // convert the output to TGA
        $image->setImageFormat('tga');
?>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM