PHP | Imagick levelImage() Function Last Updated : 27 Apr, 2023 Summarize Comments Improve Suggest changes Share Like Article Like Report 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 // Store the image into variable $imagick= "https://media.geeksforgeeks.org/wp-content/uploads/geeksforgeeks-9.png"; // Declare new Imagick object $imagick = new \Imagick($imagick); // Use Imagick::newPseudoImage() function to create // a new image using ImageMagick pseudo-formats $imagick->newPseudoimage(700, 250, 'radial-gradient:red-blue'); // Function to set image format $imagick->setFormat('png'); // Use Imagick::getQuantum() function to // return the ImageMagick quantum range $quantum = $imagick->getQuantum(); // Use Imagick::levelImage() function $imagick->levelImage($blackPoint / 100, $gamma, $quantum * $whitePoint / 100); header("Content-Type: image/png"); // Display the image as output echo $imagick->getImageBlob(); ?> Output: Reference: https://www.php.net/manual/en/imagick.levelimage.php Comment More infoAdvertise with us Next Article PHP | Imagick newImage() Function K krishnakumaryadav Follow Improve Article Tags : Web Technologies PHP PHP-function PHP-Imagick Similar Reads PHP | Gmagick levelimage() Function The Gmagick::levelimage() function is an inbuilt function in PHP which is used to adjust the levels of an image by scaling the colors falling between specified white and black points to the full available quantum range. Syntax: mixed Gmagick::levelimage( float $blackPoint, float $gamma, float $white 2 min read PHP | Imagick newImage() Function The Imagick::newImage() function is an inbuilt function in PHP which is used to creates a new image. This function creates a new image and associates ImagickPixel value as the background color. Syntax:Â bool Imagick::newImage( $cols, $rows, $background, $format ) Parameters: This function accepts fo 1 min read PHP | Imagick newImage() Function The Imagick::newImage() function is an inbuilt function in PHP which is used to creates a new image. This function creates a new image and associates ImagickPixel value as the background color. Syntax:Â bool Imagick::newImage( $cols, $rows, $background, $format ) Parameters: This function accepts fo 1 min read PHP | Imagick mapImage() Function The Imagick::mapImage() function is an inbuilt function in PHP which is used to replace the colors of an image with the closest color from a reference image. Syntax: bool Imagick::mapImage( Imagick $map, float $dither ) Parameters: This function accepts two parameters as mentioned above and describe 1 min read PHP | Imagick newPseudoImage() Function The Imagick::newPseudoImage() function is an inbuilt function in PHP which is used to creates a new image using ImageMagick pseudo-formats. Syntax: bool Imagick::newPseudoImage( $columns, $rows, $pseudoString ) Parameters: This function accepts three parameters mentioned above and described below: $ 1 min read PHP | Imagick newPseudoImage() Function The Imagick::newPseudoImage() function is an inbuilt function in PHP which is used to creates a new image using ImageMagick pseudo-formats. Syntax: bool Imagick::newPseudoImage( $columns, $rows, $pseudoString ) Parameters: This function accepts three parameters mentioned above and described below: $ 1 min read Like