PHP | Imagick modulateImage() Function

The Imagick::modulateImage() function is an inbuilt function in PHP which is used to control the brightness, saturation, and hue of an image.


bool Imagick::modulateImage( $brightness, $saturation, $hue )

Parameters: This function accepts three parameters as mentioned above and described below:

  • $brightness: This parameter is used to hold the value of brightness.
  • $saturation: This parameter is used to hold the value of saturation.
  • $hue: This parameter is used to hold the value of hue.

Return Value: This function returns True on success.

Below programs illustrate the Imagick::modulateImage() function in PHP:

Original Image:

Program 1:

/*require_once('vendor/autoload.php'); */
header('Content-type: image/png');
/*Crete Imagick Object*/
$image = new Imagick('img/geeksforgeeks.png');
/*modulateImage function*/
$image->modulateImage(60, 100, 100);
echo $image;

Modulate Image

Program 2:

/*Imagick Object*/
$imagick = new Imagick('img/geeksforgeeks.png');
$imagick->modulateImage(100, 0, 100);
/*Write Image*/
/*Destroy Imagick Variable*/

Modulate Image

Reference: http://php.net/manual/en/imagick.modulateimage.php

This article is attributed to GeeksforGeeks.org

You Might Also Like

leave a comment



load comments

Subscribe to Our Newsletter