【发布时间】:2011-05-04 23:42:04
【问题描述】:
我正在尝试使用 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 吗?
【问题讨论】:
-
你可以使用 ImageMagick 吗?
标签: php png gdlib png-24 png-8