PHP | Imagick setImageCompose() Function
The Imagick::setImageCompose() function is an inbuilt function in PHP which is used to set the composite operator associated with the image. This function is used to specify how to composite the image thumbnail when using the Imagick::montageImage() method.
Syntax:
bool Imagick::setImageCompose( int $compose )
Parameters: This function accepts a single parameter $compose which holds the image composite operator.
Return Value: This function returns TRUE on success.
Exceptions: This function throws ImagickException on error.
Below programs illustrate the Imagick::setImageCompose() function in PHP:
Program 1:
<?php
$imagick = new Imagick(
$imagick ->setImageCompose(70);
$compose = $imagick ->getImageCompose();
echo $compose ;
?>
|
Output:
70
Program 2:
<?php
$imagick = new Imagick(
$imagick ->labelImage( 'Image 1' );
$imagick ->setImageCompose(10);
$imagick ->addImage( new Imagick(
$imagick ->labelImage( 'Image 2' );
$imagick ->setImageCompose(30);
$draw = new ImagickDraw();
$draw ->setStrokeColor( 'black' );
$draw ->setFillColor( 'white' );
$draw ->setStrokeWidth(1);
$draw ->setFontSize(24);
$montage = $imagick ->montageImage( $draw , "3x2+0+0" , "200x160+3+3>" ,
Imagick::MONTAGEMODE_CONCATENATE, "10x10+2+2" );
$montage ->setImageFormat( 'png' );
header( "Content-Type: image/png" );
echo $montage ->getImageBlob();
?>
|
Output:
Reference: https://www.php.net/manual/en/imagick.setimagecompose.php
Last Updated :
20 Nov, 2019
Like Article
Save Article
Share your thoughts in the comments
Please Login to comment...