Imagick::getImageAlphaChannel

(PECL imagick 2 >= 2.3.0, PECL imagick 3)

Imagick::getImageAlphaChannel β€” VΓ©rifie si l'image a un canal alpha

Description

public Imagick::getImageAlphaChannel(): bool

Retourne si l'image a un canal alpha.

Liste de paramètres

Cette fonction ne contient aucun paramètre.

Valeurs de retour

Retourne true si l'image a une valeur de canal alpha et false sinon, c'est-Γ -dire que l'image est RGB plutΓ΄t que RGBA ou CMYK plutΓ΄t que CMYKA.

Erreurs / Exceptions

Lance une exception ImagickException si une erreur survient.

Historique

Version Description
PECL imagick 3.6.0 Retourne un boolΓ©en maintenant ; auparavant, un entier Γ©tait retournΓ©.
οΌ‹add a note

User Contributed Notes 1 note

up
0
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));
To Top