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 than 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:
The below program illustrates the Imagick::haldClutImage() function in PHP.
Program 1:
php
<?php
$imagick = new \Imagick( realpath ( 'img/geeksforgeeks.png' ));
$imagickPalette = new \Imagick( realpath ("img/geeksforgeeks.png"));
$imagickPalette ->sepiatoneImage(50);
$imagick ->haldClutImage( $imagickPalette );
header("Content-Type: image/jpg");
echo $imagick ->getImageBlob();
?>
|
Output:
Program 2:
php
<?php
$imagick = new Imagick( 'img/geeksforgeeks.png' );
$imagickPalette = new Imagick("img/geeksforgeeks.png");
$imagickPalette ->sepiatoneImage(150);
$imagick ->haldClutImage( $imagickPalette );
$imagick ->writeImage( 'raiseImae1.png' );
$imagick ->destroy();
?>
|
Output:
Reference: http://php.net/manual/en/imagick.haldclutimage.php
Last Updated :
27 Apr, 2023
Like Article
Save Article
Share your thoughts in the comments
Please Login to comment...