PHP Imagick setImageBackgroundColor () Function

PHP

Syntax:
bool Imagick::setImageBackgroundColor (mixed $background)
Parameters:This function takes one parameter $background,which contains the background color.Return Value:This function returns TRUE on success.Exceptions:this function throws an ImagickException on error.The following programs illustrate the function Imagick::setImageBackgroundColor() in PHP:Program 1:  
// Create a new imagick object $imagick = new Imagick (' https://media.engineerforengineer. org / wp-content / uploads / engineerforengineer-13.png ' );  
// Set background color $imagick -> setImageBackgroundColor ( 'yellow' );  
// Set ImageAlphaChannel to 9, which matches
// imagine::ALPHACHANNEL_TRANSPARENT $imagick -> setImageAlphaChannel (9);  
// Show image header ( "Content-Type: image / png" ); echo $imagick -> getImageBlob(); ?>
Output: Program 2:  
// Create new imagick object $imagick = new Imagick();  
// Write a title on the image $imagick -> newPseudoImage (800, 270, "caption: GeekforGeeks " );  
// Set background color $imagick -> setImageBackgroundColor ( 'gray' );  
// Set ImageAlphaChannel to 9, which matches
// imagine::ALPHACHANNEL_TRANSPARENT $imagick -> setImageAlphaChannel (9);  
// Show image $imagick -> setformat ( 'png' ); header ( "Content-Type: image / png" ); echo $imagick -> getImageBlob(); ?>
Output: Link: https://www.php.net/manual/en/imagick.setimagebackgroundcolor.php