PHP imagecolorclosest - Get the Index of the Color Closest to the Specified Color
imagecolorclosest — Gets the index value of the color closest to the specified color.
Syntax
int imagecolorclosest ( resource $image , int $red , int $green , int $blue )
Returns the color in the image palette 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 of a point in three-dimensional space.
If the image was created from a file, only colors actually used in the image are resolved. Colors that appear only in the palette are not resolved.
Related Articles
- imagecolorexact() Get the index value of the specified color.
PHP Image Processing