Imagick::getImageAlphaChannel
(PECL imagick 2 >= 2.3.0, PECL imagick 3)
Imagick::getImageAlphaChannel — 检查图像是否有 alpha 通道
参数
此函数没有参数。
错误/异常
错误时抛出 ImagickException。
+添加备注
用户贡献的备注 1 note
phroggar ¶
3 years ago
You want to check wether an image has an alpha channel? But you have no control which Imagick Version is used?
Background:
Method available since ImageMagick 6.4.0
Method returns boolean instead of int since 6.9.x
Example:
$image= new Imagick();
$image->readImage($source_file);
$imageHasAlphaChannel = (method_exists($image, 'getImageAlphaChannel') && ($document->getImageAlphaChannel() === \Imagick::ALPHACHANNEL_ACTIVATE || $document->getImageAlphaChannel() === true));
备份地址:http://www.lvesu.com/blog/php/imagick.getimagealphachannel.php