Black and white and color specified index achieved the closest hue - PHP imagecolorclosesthwb
imagecolorclosesthwb - acquires the specified color index closest to black and white chromaticity.
grammar
int imagecolorclosesthwb ( resource $image , int $red , int $green , int $blue )
Black and white index acquires color closest to a given chromaticity.
Note: This function requires GD 2.0.1 or later (2.0.28 or later recommended).
parameter
- image created by the image function (for example imagecreatetruecolor ()) image resource returned.
- valuered red component.
- green value for the green component.
- blue blue component value.
return value
It returns an integer index is black and white color closest to a given chromaticity.
Examples
<?php $im = imagecreatefromgif('php.gif'); echo 'HWB: ' . imagecolorclosesthwb($im, 116, 115, 152); imagedestroy($im); ?>
Output similar to the above example:
HWB: 33
related articles
- imagecolorclosest () Get the index of the closest color to the specified color.