我想通过php Object Imagick将PNG32转换为PNG8.但我使用setImageDepth和setImageFormat设置param为8bit,它没有生效.像这样的代码:
$im = new Imagick($image);
$im->cropImage($cutWidth,$cutHeight,$x,$y);
$im->thumbnailImage($maxWidth, $maxHeight);
$im->setImageDepth(8);
$im->setImageFormat('PNG8');
$im->writeImage($filename);
Run Code Online (Sandbox Code Playgroud)
inputfile是PNG32,但上面的输出仍然是PNG8,有其他解决方案吗?