Page 1 of 1
Get the html color from a picture
Posted: Tue Jan 08, 2008 9:07 pm
by psychotomus
I wish to get the html color of a picture say and co-ords 0,0 top left pixel?
is this possible? if so, what function would I use?
Posted: Tue Jan 08, 2008 9:10 pm
by feyd
The image functions would prove useful here....
Posted: Tue Jan 08, 2008 9:16 pm
by psychotomus
I browsed threw them all.
I closest thing I found was
http://us2.php.net/manual/en/function.imagecolorat.php
but that only returns the RGB values and not HTML values. How can I convert the RGB values to an HTML value?
Posted: Wed Jan 09, 2008 7:25 am
by superdezign
psychotomus wrote:but that only returns the RGB values and not HTML values. How can I convert the RGB values to an HTML value?
"HTML values" are actually hex values. Hex is base 16. Decimal (regular numbers) is base 10.
What you want to do is convert the decimal RGB value to a hex RGB value. You can use
dechex() to do the conversion for you, and then just concatenate the three hex values together as a string.