Imagick::clutImage()函數是PHP中的內置函數,用於替換圖像中的顏色。此函數的第二個參數替換特定通道中的顏色。
用法:
bool Imagick::clutImage( $lookup_table, $channel = Imagick::CHANNEL_DEFAULT )
參數:該函數支持上述和以下所述的兩個參數:
- $lookup_table:此參數包含用於顏色查找表的Imagick對象。
- $channel:通道常數提供了對您的通道模式有效的任何通道。 $channel的默認值為Imagick::CHANNEL_DEFAULT。
返回值:如果成功,此函數返回True;如果失敗,則返回false。
以下示例程序旨在說明PHP中的Imagick::clutImage()函數:
程序:
<?php
// Declare an Imagick object
$image = new Imagick(
'https://contribute.geeksforgeeks.org/wp-content/uploads/geeksforgeeks-17.png');
$clut = new Imagick();
// Imagick object choosen green color from color lookup table
$clut->newImage(1, 1, new ImagickPixel('green'));
// No channel is applied hence default channel is used
$image->clutImage($clut);
header("Content-Type: image/jpg");
// Display the output image
echo $image->getImageBlob();
?>
輸出:
參考: https://www.php.net/manual/en/imagick.clutimage.php
相關用法
- PHP Imagick distortImage()用法及代碼示例
- PHP Imagick readImage()用法及代碼示例
- PHP Imagick readImageFile()用法及代碼示例
- PHP Imagick remapImage()用法及代碼示例
- PHP Imagick readImages()用法及代碼示例
- PHP Imagick getCopyright()用法及代碼示例
- PHP Imagick extentImage()用法及代碼示例
- PHP Imagick separateImageChannel()用法及代碼示例
- PHP Imagick sepiaToneImage()用法及代碼示例
- PHP Imagick setColorspace()用法及代碼示例
- PHP Imagick despeckleImage()用法及代碼示例
- PHP Imagick convolveImage()用法及代碼示例
- PHP Imagick gaussianBlurImage()用法及代碼示例
- PHP Imagick enhanceImage()用法及代碼示例
- PHP Imagick encipherImage()用法及代碼示例
注:本文由純淨天空篩選整理自VigneshKannan3大神的英文原創作品 PHP | Imagick clutImage() Function。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。