PHP | Imagick levelImage() Function
The Imagick::levelImage() function is an inbuilt function in PHP that is used to adjust the levels of an image.
Syntax:
bool Imagick::levelImage( $blackPoint, $gamma,
$whitePoint, $channel = Imagick::CHANNEL_DEFAULT )
Parameters: This function accepts four parameters as mentioned above and described below:
- blackPoint: This parameter holds the black point of an image.
- gamma: This parameter holds the value of gamma.
- whitePoint: This parameter holds the white point of an image.
- channel: This parameter holds the channel constant that is valid for channel mode. Use a bit-wise operator to combine more than one channel.
Return Value: This function returns TRUE on success.
Errors/Exceptions: This function throws ImagickException on error. The below program illustrates the Imagick::levelImage() function in PHP.
Program:
php
<?php
$imagick =
"https:
$imagick = new \Imagick( $imagick );
$imagick ->newPseudoimage(700, 250, 'radial-gradient:red-blue' );
$imagick ->setFormat( 'png' );
$quantum = $imagick ->getQuantum();
$imagick ->levelImage( $blackPoint / 100, $gamma , $quantum * $whitePoint / 100);
header("Content-Type: image/png");
echo $imagick ->getImageBlob();
?>
|
Output:
Reference: https://www.php.net/manual/en/imagick.levelimage.php
Last Updated :
27 Apr, 2023
Like Article
Save Article
Share your thoughts in the comments
Please Login to comment...