English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
imagecolorclosesthwb — Get the index of the closest shade of the specified color.
int imagecolorclosesthwb ( resource $image , int $red , int $green , int $blue )
Get the index of the closest shade of the given color.
Note:This function requires GD 2.0.1 or higher versions (recommended 2.0.28 and higher versions).
imageImage resource returned by the image creation function (such as imagecreatetruecolor()).
redValue of the red component.
greenValue of the green component.
blueValue of the blue component.
Returns an integer, which is the index of the closest shade of the given color.
<?php $im = imagecreatefromgif('php.gif'); echo 'HWB: ' . imagecolorclosesthwb($im, 116, 115, 152); imagedestroy($im); ?>
The output of the above example is similar to:
HWB: 33
imagecolorclosest() Get the index value of the color closest to the specified color.