【发布时间】:2020-09-19 13:53:05
【问题描述】:
我想像这个例子一样使用 PHP 代码
<?
$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
?>
但我找不到 Cluster-fit true|false 和 Mipmaps = X 的缺失集参数 所以我坚持使用 php exec,这迫使我首先保存 png,以便 exec() 可以访问它以将其转换为 dds。
exec("convert -format dds -define dds:compression=dxt5 -define dds:mipmaps=6 -define dds:cluster-fit=true ".$ziptempDir.$fileName." ".$ziptempDir.$fileNameDDS."");
我在 php.net 上找不到参数,所以它们不适用于 php imagick,如果是这样,有人知道如何获取/翻译它们以像第一个示例中那样使用它吗?
谢谢
【问题讨论】:
-
试试
$imagick->setOption("dds:mipmaps", 6); -
哇,它有效......我之前尝试过,但我敢打赌我有一个错字。非常感谢!
-
酷!由于您有工作且经过测试的代码,因此您可以编写代码供其他人查看并通过接受您自己的答案来获取分数。
标签: php imagemagick imagick mipmaps