<?php
// Load an image
$im = imagecreatefromgif('phplogo.gif');
// Get closest colors from the image
$colors = array();
$colors[] = imagecolorresolve($im, 255, 255, 255);
$colors[] = imagecolorresolve($im, 0, 0, 200);
// Output
print_r($colors);
imagedestroy($im);
?>
The above example will output
something similar to:
Array
(
[0] => 89
[1] => 85
)