PHP Imagick negateImage () function


bool Imagick::negateImage ($gray, $channel)
Parameters:This function takes two parameters as above and described below:
  • $gray:This parameter is used to set only negative grayscale in the image.
  • $channel:This parameter provides a channel constant that is valid for channel mode. More than one channel can be combined using the bitwise operator. The default channel in the Imagick function is Imagick::CHANNEL_DEFAULT.
Return value:This function returns True on success.Errors / Exceptions:this function throws a exceptionImagickException on error.The following program illustrates the Imagick::negateImage()function in PHP :Program :  
// Create an imagick object $imagick = new Imagick ( ` https://media.engineerforgeek ` );  
// Using the negateImage function $imagick -> negateImage ( `true` ); header ( " Content-Type: image / jpg " );  
// Display the output image echo $imagick -> getImageBlob(); ?>
Output: Related Articles:
  • PHP | Imagick blurImage() function
  • PHP | Imagick transformImageColorspace() function

Get Solution for free from DataCamp guru