PHP imagecolorclosest - Get the index value of the color closest to the specified color

PHP 图像处理PHP Image Processing

imagecolorclosest — Get 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 "closest" to the specified RGB value in the image palette.

The "distance" between the specified color and each color in the palette is calculated by treating the RGB values as coordinates of points in 3D space.

If an image is created from a file, only colors used in the image will be identified. Colors that appear only in the palette will not be identified.

Related Articles

PHP 图像处理PHP Image Processing

Other Extensions