PHP 教程
imagecolorclosesthwb — 取得與指定的顏色最接近的色度的黑白色的索引。
int imagecolorclosesthwb ( resource $image , int $red , int $green , int $blue )
取得與給定顏色最接近的色度的黑白色的索引。
注意:此函數(shù)需要 GD 2.0.1 或更高版本(推薦 2.0.28 及更高版本)。
返回一個整數(shù),是給定顏色最接近的色度的黑白色的索引。
<?php $im = imagecreatefromgif('php.gif'); echo 'HWB: ' . imagecolorclosesthwb($im, 116, 115, 152); imagedestroy($im); ?>
以上實例的輸出類似于:
HWB: 33