php8.5
Home/ Manual/ image / functions/ imagecolorclosesthwb

imagecolorclosesthwb

PHP function Edit on GitHub ✎

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

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

Description

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.

Parameters

red

Red

green

Green

blue

Blue

Return Values

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

Changelog

VersionDescription

Examples

Example of using imagecolorclosesthwb()

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

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

The above example will output something similar to:

output
HWB: 33

See Also

Source: reference/image/functions/imagecolorclosesthwb.xml · from the official PHP manual (php/doc-en)