Easy Tutorial
❮ Func Date Strtotime Php Scalar Return Type ❯

PHP imagecolorclosest - Get the Index of the Closest Color to a Specified Color

PHP Image Processing

imagecolorclosest — Get the index of the closest color to a specified color.

Syntax

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

Returns the color in the palette of the image that is closest to the specified RGB value.

The "distance" between the specified color and each color in the palette is calculated by treating the RGB values as coordinates in a three-dimensional space.

If the image is created from a file, only the colors used in the image are resolved. Colors that only appear in the palette are not resolved.

Related Articles

PHP Image Processing

❮ Func Date Strtotime Php Scalar Return Type ❯