Saturday, November 22, 2025
HomeLanguagesPHP | Imagick modulateImage() Function

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.

Syntax:

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:




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


Output:
Modulate Image

Program 2:




<?php 
  
/*require_once('vendor/autoload.php');*/
/*Imagick Object*/
  
$imagick = new Imagick('img/neveropen.png');
  
/*modulateImage*/
  
$imagick->modulateImage(100, 0, 100);
  
/*Write Image*/
$imagick->writeImage('rotationalImage1.png');
  
/*Destroy Imagick Variable*/
$imagick->destroy();
?>


Output:
Modulate Image

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

RELATED ARTICLES

Most Popular

Dominic
32407 POSTS0 COMMENTS
Milvus
97 POSTS0 COMMENTS
Nango Kala
6784 POSTS0 COMMENTS
Nicole Veronica
11931 POSTS0 COMMENTS
Nokonwaba Nkukhwana
11999 POSTS0 COMMENTS
Shaida Kate Naidoo
6907 POSTS0 COMMENTS
Ted Musemwa
7168 POSTS0 COMMENTS
Thapelo Manthata
6863 POSTS0 COMMENTS
Umr Jansen
6848 POSTS0 COMMENTS