Skip to content
Related Articles

Related Articles

PHP | Imagick haldClutImage() Function

View Discussion
Improve Article
Save Article
  • Last Updated : 20 Nov, 2019

The Imagick::haldClutImage() function is an inbuilt function in PHP which is used to replace colors in the image using a Hald lookup table. Hald images can be created using HALD color coder.


bool Imagick::haldClutImage( $clut, $channel )

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

  • $clut: This parameter is used to hold the value of Imagick object containing the Hald lookup image.
  • $channel: This parameter provides the channel constant that is valid for channel mode. More then one channel can be combined using bitwise operator. The defaults channel in Imagick function is Imagick::CHANNEL_DEFAULT.

Return Value: This function returns True on success.

Errors/Exceptions: This function throws ImagickException on error.

Original Image:

Below program illustrates the Imagick::haldClutImage() function in PHP:

Program 1:

// require_once('path/vendor/autoload.php'); 
// Create new Imagick Objects
$imagick = new \Imagick(realpath('img/geeksforgeeks.png'));
$imagickPalette = new \Imagick(realpath("img/geeksforgeeks.png"));
// Use sepiatoneImage and haldClutImage function
// Image Header
header("Content-Type: image/jpg");
// Display the output image
echo $imagick->getImageBlob();


Program 2:

// require_once('path/vendor/autoload.php');
// Create new Imagick Object
$imagick = new Imagick('img/geeksforgeeks.png');
$imagickPalette = new Imagick("img/geeksforgeeks.png");
// Use haldClutImage function
// Write output Image
// Destroy Imagick object



My Personal Notes arrow_drop_up
Recommended Articles
Page :

Start Your Coding Journey Now!