PHP | Imagick getImageClipMask() Function
Last Updated :
20 Nov, 2019
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
$imagick = new Imagick(
$clipMask = new Imagick();
$clipMask ->newPseudoImage( $imagick ->getImageWidth(),
$imagick ->getImageHeight(), "caption:ClipMaskText" );
$imagick ->setImageClipMask( $clipMask );
$getclipMask = $imagick ->getImageClipMask();
$getclipMask ->setformat( 'png' );
header( "Content-Type: image/png" );
echo $getclipMask ->getImageBlob();
?>
|
Output:
Program 2:
<?php
$imagick = new Imagick(
$clipMask = new Imagick();
$clipMask ->setGravity(4);
$clipMask ->newPseudoImage( $imagick ->getImageWidth(),
$imagick ->getImageHeight(), "caption:ClipMaskText" );
$clipMask ->setImageBackgroundColor( 'green' );
$clipMask ->setImageAlphaChannel(9);
$imagick ->setImageClipMask( $clipMask );
$getclipMask = $imagick ->getImageClipMask();
$getclipMask ->setformat( 'png' );
header( "Content-Type: image/png" );
echo $getclipMask ->getImageBlob();
?>
|
Output:
Reference: https://www.php.net/manual/en/imagick.getimageclipmask.php
Like Article
Suggest improvement
Share your thoughts in the comments
Please Login to comment...