The Imagick::setImage() function is an inbuilt function in PHP which is used to replace an image in the object.
Syntax:
bool Imagick::setImage( Imagick $replace )
Parameters: This function accepts single parameter $replace which holds an Imagick object.
Return Value: This function returns TRUE on success.
Exceptions: This function throws ImagickException on error.
Below program illustrates the Imagick::setImage() function in PHP:
Program:
<?php // Create two Imagick objects $imagick_source = new Imagick( $imagick_replace = new Imagick( // Replacing neveropen24.png with colorize1.png $imagick_source ->setImage( $imagick_replace ); // Display the output image header( 'Content-type: image/jpeg' ); echo $imagick_source ; ?> |
Output:
Reference: https://www.php.net/manual/en/imagick.setimage.php