|
imagecolorclosestGet the index of the closest color to the specified color Description
int imagecolorclosest(
GdImage $image ,int $red ,int $green ,int $blue ) Returns the index of the color in the palette of the image which is "closest" to the specified RGB value. The "distance" between the desired color and each color in the palette is calculated as if the RGB values represented points in three-dimensional space. If you created the image from a file, only colors used in the image are resolved. Colors present only in the palette are not resolved. Parameters
Return ValuesReturns the index of the closest color, in the palette of the image, to the specified one Changelog
Examples
Example #1 Search for a set of colors in an image
The above example will output something similar to: #0: Search (254, 145, 154); Closest match: (252, 150, 148). #1: Search (153, 145, 188); Closest match: (148, 150, 196). #2: Search (153, 90, 145); Closest match: (148, 90, 156). #3: Search (255, 137, 92); Closest match: (252, 150, 92). See Also
|