PHP | Imagick haldClutImage() Function
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.
Syntax:
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:
<?php // 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 $imagickPalette->sepiatoneImage(50); $imagick->haldClutImage($imagickPalette); // Image Header header("Content-Type: image/jpg"); // Dispay the output image echo $imagick->getImageBlob(); ?> |
Output:

Program 2:
<?php // 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 $imagickPalette->sepiatoneImage(150); $imagick->haldClutImage($imagickPalette); // Write output Image $imagick->writeImage('raiseImae1.png'); // Destroy Imagick object $imagick->destroy(); ?> |
Output:

Reference: http://php.net/manual/en/imagick.haldclutimage.php
Recommended Posts:
- PHP | Imagick convolveImage() Function
- PHP | Imagick despeckleImage() Function
- PHP | Imagick gammaImage() Function
- PHP | Imagick cropThumbnailImage() Function
- PHP | Imagick implodeImage() Function
- PHP | Imagick clear() Function
- PHP | Imagick averageImages() Function
- PHP | Imagick getCopyright() Function
- PHP | Imagick evaluateImage() Function
- PHP | Imagick appendImages() Function
- PHP | Imagick distortImage() Function
- PHP | Imagick affineTransformImage() Function
- PHP | Imagick pingImage() Function
- PHP | Imagick liquidRescaleImage() Function
- PHP | Imagick cycleColormapImage( ) Function
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.



