Php Imagecolorclosesthwb
# PHP imagecolorclosesthwb - Get the index of the black-and-white color closest in hue to a specified color
[PHP Image Processing](#)
imagecolorclosesthwb β Get the index of the black-and-white color closest in hue to a specified color.
### Syntax
int imagecolorclosesthwb ( resource $image , int $red , int $green , int $blue )
Get the index of the black-and-white color closest in hue to the given color.
**Note:** This function requires GD 2.0.1 or higher (version 2.0.28 and above is recommended).
### Parameters
* **image** An image resource returned by an image creation function (e.g., imagecreatetruecolor()).
* **red** The value of the red component.
* **green** The value of the green component.
* **blue** The value of the blue component.
### Return Value
Returns an integer, the index of the black-and-white color closest in hue to the given color.
### Example
The output of the above example is similar to:
HWB: 33
### Related Articles
Get the index value of the color closest to a specified color.
[PHP Image Processing](#)
YouTip