= 4.0.1, PHP 5, PHP 7, PHP 8)imagecolorclosesthwb — 取得與給定顏色最接近的色度的黑白色的索引 說明imagecolorclosesthwb( resource $image, in">

imagecolorclosesthwb

(PHP 4 >= 4.0.1, PHP 5, PHP 7, PHP 8)

imagecolorclosesthwb 取得與給定顏色最接近的色度的黑白色的索引

說明

imagecolorclosesthwb(
    resource $image,
    int $red,
    int $green,
    int $blue
): int

取得與給定顏色最接近的色度的黑白色的索引。

參數(shù)

image

由圖象創(chuàng)建函數(shù)(例如imagecreatetruecolor())返回的 GdImage 對象。

red

紅色成分的值。

green

綠色成分的值。

blue

藍色成分的值。

返回值

返回一個整數(shù),是給定顏色最接近的色度的黑白色的索引。

范例

示例 #1 使用 imagecolorclosesthwb() 的例子

<?php
$im 
imagecreatefromgif('php.gif');

echo 
'HWB: ' imagecolorclosesthwb($im116115152);

imagedestroy($im);
?>

以上例程的輸出類似于:

HWB: 33

更新日志

版本 說明
5.3.0 在 Windows 平臺上可用

參見