Reputation: 20745
i work now with GD library on PHP and i'm trying to get the pixel color name ,i mean : green , red , blue , etc...
i'm getting the color this way :
$rgb = ImageColorAt($image, $X, $y);
$r = ($rgb >> 16) & 0xFF ;
$g = ($rgb >> 8) & 0xFF;
$b = $rgb & 0xFF;
now , how can i find it this color is green light , dark blue , normal blue or red and etc..
Upvotes: 5
Views: 2629
Reputation: 3431
you have to create an associative-array that maps value => colorname (or inverse). fill this array with the data of this table: http://en.wikipedia.org/wiki/Web_colors
then you can lookup the color names, that are available in CSS too. additionally you can add more, own, colornames
Upvotes: 4
Reputation: 47619
Are you suppose that every color has its own name?
It's 16^6>16.7 millions.
So, it seems to be impossible.
But you may create your own database (format rgb => human-readable)
Upvotes: 2