imagecolorclosesthwb

(PHP 4 >= 4.0.1, PHP 5, PHP 7, PHP 8)

imagecolorclosesthwbGet the index of the color which has the hue, white and blackness

Опис

imagecolorclosesthwb(
    GdImage $image,
    int $red,
    int $green,
    int $blue
): int

Get the index of the color which has the hue, white and blackness nearest the given color.

Параметри

image

Об'єкт GdImage, що повертається однією з функцій створення зображення, такою як imagecreatetruecolor().

red

Значення червоного компонента.

green

Значення зеленого компонента.

blue

Значення синього компонента.

Значення, що повертаються

Returns an integer with the index of the color which has the hue, white and blackness nearest the given color.

Журнал змін

Версія Опис
8.0.0 Тепер image має бути примірником GdImage. Раніше очікувався gd-resource.

Приклади

Приклад #1 Example of using imagecolorclosesthwb()

<?php
$im
= imagecreatefromgif('php.gif');

echo
'HWB: ' . imagecolorclosesthwb($im, 116, 115, 152);
?>

Поданий вище приклад виведе щось схоже на:

HWB: 33

Прогляньте також