$red = 161;
$green = 40;
$blue = 41;
/**
* create image and put pixels in of our color
*/
$pic = imagecreatetruecolor(10,10);
$white = imagecolorallocate($pic, 255, 255, 255);
$ourcolor = imagecolorallocate($pic, 161, 40, 41);
imagefill($pic, 0,0,$white);
imagefilledrectangle($pic, 5, 5, 7, 7, $ourcolor);
/**
* now find where color occurs in image
*/
$srch_rgb = ($red << 16) + ($green << 8) + $blue;
$w = imagesx ($pic);
$h = imagesy ($pic);
for ($x=0; $x<$w; $x++)
{
for ($y=0; $y<$h; $y++)
{
if (imagecolorat($pic, $x, $y) == $srch_rgb) echo "$x, $y <br/>";
}
}
منبع: http://www.phpfreaks.com/forums/php-...agecolorexact/