Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

PHP imagecolorclosesthwb - Get the Index of the Grayscale Closest to the Specified Color

PHP imagecolorclosesthwb - Get the Index of the Grayscale Closest to the Specified Color

PHP Image ProcessingPHP Image Processing

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

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

PHP Image ProcessingPHP Image Processing