Imagick::uniqueImageColors()函數是PHP中的內置函數,用於丟棄任何像素顏色以外的所有像素顏色。此函數在6.2.9版或更高版本中可用。
用法:
bool Imagick::uniqueImageColors( void )
參數:該函數不接受任何參數。
返回值:成功時此函數返回True。
以下示例程序旨在說明PHP中的Imagick::uniqueImageColors()函數:
程序:
<?php
// Create an Imagick object
$imagick = new Imagick(
'https://media.geeksforgeeks.org/wp-content/uploads/geeksforgeeks-9.png');
// Reduce the image to 256 colours nicely.
$imagick->quantizeImage(256, \Imagick::COLORSPACE_YIQ, 0, false, false);
// Use uniqueImageColors function to distinguish the color of image
$imagick->uniqueImageColors();
// Scale the output image
$imagick->scaleimage($imagick->getImageWidth() * 10,
$imagick->getImageHeight() * 50);
header("Content-Type: image/png");
// Display the output image
echo $imagick->getImageBlob();
?>
輸出:
相關文章:
參考: http://php.net/manual/en/imagick.uniqueimagecolors.php
相關用法
- PHP Imagick distortImage()用法及代碼示例
- PHP Imagick readImage()用法及代碼示例
- PHP Imagick readImageFile()用法及代碼示例
- PHP Imagick getCopyright()用法及代碼示例
- PHP Imagick extentImage()用法及代碼示例
- PHP Imagick remapImage()用法及代碼示例
- PHP Imagick readImages()用法及代碼示例
- PHP Imagick setColorspace()用法及代碼示例
- PHP Imagick separateImageChannel()用法及代碼示例
- PHP Imagick sepiaToneImage()用法及代碼示例
- PHP Imagick convolveImage()用法及代碼示例
- PHP Imagick despeckleImage()用法及代碼示例
- PHP Imagick polaroidImage()用法及代碼示例
- PHP Imagick embossImage()用法及代碼示例
- PHP Imagick enhanceImage()用法及代碼示例
注:本文由純淨天空篩選整理自Mahadev99大神的英文原創作品 PHP | Imagick uniqueImageColors() Function。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。