Imagick::getImageAlphaChannel

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

Imagick::getImageAlphaChannelGets the image alpha channel

설명

int Imagick::getImageAlphaChannel ( void )

Gets the image alpha channel value. The returned value is one of the alpha channel constants. 이 메쏘드는 Imagick을 ImageMagick 6.4.0 이상으로 컴파일 했을 때만 사용할 수 있습니다.

반환값

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

오류/예외

오류시에 ImagickException이 발생합니다.

add a note add a note

User Contributed Notes 1 note

up
1
phroggar
2 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));
To Top