Imagick::setImageMatteColor()函數是PHP中的內置函數,用於設置圖像遮罩顏色。
用法:
bool Imagick::setImageMatteColor( mixed $matte )
參數:此函數接受單個參數$matte,該參數保存圖像的無光澤顏色。
返回值:成功時此函數返回TRUE。
異常:該函數在錯誤時引發ImagickException。
以下示例程序旨在說明PHP中的Imagick::setImageMatteColor()函數:
程序1:
<?php
// Create a new imagick object
$imagick = new Imagick(
'https://media.geeksforgeeks.org/wp-content/uploads/geeksforgeeks-13.png');
// Set the Matte Color Pixel
$imagick->setImageMatteColor('skyblue');
// Get the Matte Color Pixel
$matteColorPixel = $imagick->getImageMatteColor();
// Convert ImagickPixel into Color
$matteColor = $matteColorPixel->getColorAsString();
echo $matteColor;
?>
輸出:
srgb(135, 206, 235)
程序2:
<?php
// Create a new imagick object
$imagick = new Imagick(
'https://media.geeksforgeeks.org/wp-content/uploads/geeksforgeeks-13.png');
// Set the Matte Color Pixel
$imagick->setImageMatteColor('turquoise');
// Get the Matte Color Pixel
$matteColorPixel = $imagick->getImageMatteColor();
// Convert ImagickPixel into Color
$matteColor = $matteColorPixel->getColorAsString();
echo $matteColor;
?>
輸出:
srgb(64, 224, 208)
參考: https://www.php.net/manual/en/imagick.setimagemattecolor.php
相關用法
- PHP Imagick remapImage()用法及代碼示例
- PHP Imagick readImageFile()用法及代碼示例
- PHP Imagick readImage()用法及代碼示例
- PHP Imagick distortImage()用法及代碼示例
- PHP Imagick getCopyright()用法及代碼示例
- PHP Imagick extentImage()用法及代碼示例
- PHP Imagick separateImageChannel()用法及代碼示例
- PHP Imagick sepiaToneImage()用法及代碼示例
- PHP Imagick convolveImage()用法及代碼示例
- PHP Imagick readImages()用法及代碼示例
- PHP Imagick despeckleImage()用法及代碼示例
- PHP Imagick enhanceImage()用法及代碼示例
- PHP Imagick encipherImage()用法及代碼示例
- PHP Imagick embossImage()用法及代碼示例
- PHP Imagick gaussianBlurImage()用法及代碼示例
注:本文由純淨天空篩選整理自gurrrung大神的英文原創作品 PHP | Imagick setImageMatteColor() Function。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。