imagecolorclosesthwb — Gets the black-and-white index of the tint closest to the specified color.
int imagecolorclosesthwb ( resource $image , int $red , int $green , int $blue )
Gets the index of the black and white color closest to the given color.
Note: This function requires GD 2.0.1 or higher (2.0.28 and higher recommended).
imageThe image resource returned by the image creation function (such as imagecreatetruecolor()).
redThe value of the red component.
greenThe value of the green component.
blueThe value of the blue component.
Returns an integer that is the black-white index of the closest hue to 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() Gets the index value of the color closest to the specified color.