Bourns
Bourns

Reputation: 41

PNG to DDS with Imagick missing Set Arguments

I would like to use the PHP Code like this example

<?
$img = new Imagick('test.png'); //Load the uploaded image
$img->setformat('dds'); //Set the format to dds
$img->setImageCompression(Imagick::COMPRESSION_DXT5); //Set compression method
$img->writeimage('test.dds'); //Write/save the dds texture
?>

but i cant find the missing set Arguments for Cluster-fit true|false and Mipmaps = X so i am stuck to use php exec which forces me to save the png first so exec() can reach it to convert it into dds.

exec("convert -format dds -define dds:compression=dxt5 -define dds:mipmaps=6 -define dds:cluster-fit=true ".$ziptempDir.$fileName." ".$ziptempDir.$fileNameDDS."");

i can`t find the Arguments on php.net , so are they not aivailible for php imagick and if so, does anybody know how to get/translate them to use it like in the first example ?

Thanks

Upvotes: 1

Views: 408

Answers (1)

Bourns
Bourns

Reputation: 41

Here is the working Code with the setOptions for mipmaps x and cluster-fit true|false which is not descriped on php.net

    $imgSkinFull->setImageCompression(Imagick::COMPRESSION_DXT5);
    $imgSkinFull->setOption("dds:mipmaps", 6);
    $imgSkinFull->setOption("dds:cluster-fit", true);
    $imgSkinFull->setformat('dds');
    $imgSkinFull->writeimage($ziptempDir.$fileNameDDS);
    $imgSkinFull->destroy();

Upvotes: 2

Related Questions