The Imagick::getImageClipMask() function is an inbuilt function in PHP which is used to get the image clip mask.
Syntax:
array Imagick::getImageClipMask( void )
Parameters: This function does not accept any parameters.
Exceptions: This function throws ImagickException on error.
Return Value: This function returns an Imagick object containing the clip mask.
Below programs illustrate the Imagick::getImageClipMask() function in PHP:
Program 1:
<?php   // Create two new imagick objects $imagick = new Imagick( $clipMask = new Imagick();   $clipMask ->newPseudoImage( $imagick ->getImageWidth(),                 $imagick ->getImageHeight(), "caption:ClipMaskText" );   // Set the clip mask $imagick ->setImageClipMask( $clipMask );   // Get the clip mask $getclipMask = $imagick ->getImageClipMask();   // Show the output $getclipMask ->setformat( 'png' ); header( "Content-Type: image/png" ); echo $getclipMask ->getImageBlob(); ?> |
Output:
Program 2:
<?php // Create two new imagick objects $imagick = new Imagick( Â Â $clipMask = new Imagick(); Â Â $clipMask ->setGravity(4); Â Â // Add text to the clipMask $clipMask ->newPseudoImage( $imagick ->getImageWidth(), Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â $imagick ->getImageHeight(), "caption:ClipMaskText" ); Â Â $clipMask ->setImageBackgroundColor( 'green' ); $clipMask ->setImageAlphaChannel(9); Â Â // Set the clip mask $imagick ->setImageClipMask( $clipMask ); Â Â // Get the clip mask $getclipMask = $imagick ->getImageClipMask(); Â Â // Show the output $getclipMask ->setformat( 'png' ); header( "Content-Type: image/png" ); echo $getclipMask ->getImageBlob(); ?> |
Output:
Reference: https://www.php.net/manual/en/imagick.getimageclipmask.php