我试图用getimagesize
或 Imagick 来区分 PNG-8 和 PNG-24 图像,但我不太清楚如何去做。
getimagesize
不返回我的 PNG 的频道,而是显示 mimetype。它适用于其他图像并显示正确的值,但对于 PNG,它什么也不显示。
编辑:Imagick 没有安装在我的环境中,但 gdlib 是......
谁能帮我一点忙?
问候,
汤姆
编辑2:有可能这样做吗?
//create png for tests
$testPng = imagecreatefrompng( $file );
//test how many colors are used
$meta .= 'colors: ' . imagecolorstotal( $testPng );
$meta .= ' truecolor: ' . imageistruecolor( $testPng );
//destroy the test image
imagedestroy( $testPng );
如果 truecolor 为 false 或未设置,它是 png24 吗?