Syntax:bool Imagick::contrastImage (bool $sharpen)
Parameters:This function takes one parameter,
$sharpen,which decides whether to increase or decrease the contrast.
Return value: this function returns True on success.Errors / Exceptions:This function throws a exceptionImagickException on error.Below the programs above illustrate the Imagick::contrastImage() functionin PHP:Program 1:
// Create a new object Imagick
$imagick
=
new
Imagick (
’ https://media.engineerforengineer.org/wp-content/uploads/engineerforengineer-9.png ’
);
// Apply the image contrast function()
$imagick
-> contrastImage (false);
header (
" Content-Type: image / png "
);
// Display the output image
echo
$imagick
-> getImageBlob();
?>
Output: Program 2:
// Create new Imagick object
$imagick
=
new
Imagick (
’ https://media.engineerforengineer.org/wp-content/uploads/engineerforengineer-9.png ’
);
// Apply the image contrast function()
$imagick
-> contrastImage (true);
header (
" Content-Type: image / png "
);
// Display the output image
echo
$imagick
-> getImageBlob();
?>
Output: Link: https://www.php.net/manual/en/imagick.contrastimage.php