Get the index of the specified color + alpha or its closest possible alternative in PHP
Description
The following code shows how to get the index of the specified color + alpha or its closest possible alternative.
Example
<?php//from w w w . ja va 2 s. c om
// Load an image
$im = imagecreatefromgif('./test.gif');
// Get closest colors from the image
$colors = array();
$colors[] = imagecolorresolvealpha($im, 255, 255, 255, 0);
$colors[] = imagecolorresolvealpha($im, 0, 0, 200, 127);
// Output
print_r($colors);
imagedestroy($im);
?>
The code above generates the following result.