Easy Tutorial
❮ Func Date Get Last Errors Pdostatement Closecursor ❯

PHP imagecolorclosesthwb - Get the index of the color which has the hue, whiteness and blackness closest to the given color

PHP Image Processing

imagecolorclosesthwb — Get the index of the color which has the hue, whiteness and blackness closest to the given color.

Syntax

int imagecolorclosesthwb ( resource $image , int $red , int $green , int $blue )

Get the index of the color which has the hue, whiteness and blackness closest to the given color.

Note: This function requires GD 2.0.1 or later (recommended 2.0.28 and later).

Parameters

Return Value

Returns an integer, the index of the color which has the hue, whiteness and blackness closest to the given color.

Example

<?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

Related Articles

PHP Image Processing

❮ Func Date Get Last Errors Pdostatement Closecursor ❯