Syntax:bool Imagick::setImage (Imagick $replace)
Parameters:This function takes one parameter,
$replace,which contains an Imagick object.
Return Value:This function returns TRUE if successful.
Exceptions:this function throws an ImagickException on error.The program below illustrates the
function Imagick::setImage() in PHP:Program :
// Create two Imagick objects
$imagick_source
=
new
Imagick (
’ https://media.engineerforengineer.org/wp-content/uploads/20190823154611/24engineerforengineer ’
);
$imagick_replace
=
new
Imagick (
’ https://media.engineerforengineer.org/ wp-content / uploads / 20190918234528 / colorize1.png ’
);
// Replace engineerforengineer24.png with colorize1.png
$imagick_source
-> setImage (
$imagick_replace
);
// Display the output image
header (
’Content-type: image / jpeg’
);
echo
$imagick_source
;
?>
Output: Link: https://www.php.net/manual/en/imagick.setimage.php