PHP imagecolorclosesthwb - Get the Index of the Grayscale Closest to the Specified Color
imagecolorclosesthwb — Gets the index of the grayscale (black and white) shade closest to the specified color.
Syntax
int imagecolorclosesthwb ( resource $image , int $red , int $green , int $blue )
Get the index of the grayscale (black and white) shade closest to the given color.
**Note:** This function requires GD 2.0.1 or higher (2.0.28 or higher recommended).
Parameters
- image The 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 grayscale (black and white) shade closest to the given color.
Example
The output of the example above is similar to:
HWB: 33
Related Articles
- imagecolorclosest() Get the index value of the color closest to the specified color.
PHP Image Processing