Imagick::getImageAlphaChannel

(No version information available, might only be in Git)

Imagick::getImageAlphaChannelGets the image alpha channel

Description

int Imagick::getImageAlphaChannel ( void )

Gets the image alpha channel value. The returned value is one of the alpha channel constants. This method is available if Imagick has been compiled against ImageMagick version 6.4.0 or newer.

Return Values

Returns a constant defining the current alpha channel value. Refer to this list of alpha channel constants.

Errors/Exceptions

Throws ImagickException on error.

Коментарии

Автор:
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));
2022-02-17 10:54:00
http://php5.kiev.ua/manual/ru/imagick.getimagealphachannel.html

    Поддержать сайт на родительском проекте КГБ