Get the index of the specified color in PHP
Description
The following code shows how to get the index of the specified color.
Example
<?php/* ww w .j a v a 2 s . c o m*/
// Setup an image
$im = imagecreatefrompng('./test.png');
$colors = Array();
$colors[] = imagecolorexact($im, 255, 0, 0);
$colors[] = imagecolorexact($im, 0, 0, 0);
$colors[] = imagecolorexact($im, 255, 255, 255);
$colors[] = imagecolorexact($im, 100, 255, 52);
print_r($colors);
// Free from memory
imagedestroy($im);
?>
The code above generates the following result.