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?
Get the html color from a picture
Moderator: General Moderators
-
psychotomus
- Forum Contributor
- Posts: 487
- Joined: Fri Jul 11, 2003 1:59 am
-
psychotomus
- Forum Contributor
- Posts: 487
- Joined: Fri Jul 11, 2003 1:59 am
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?
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?
- superdezign
- DevNet Master
- Posts: 4135
- Joined: Sat Jan 20, 2007 11:06 pm
"HTML values" are actually hex values. Hex is base 16. Decimal (regular numbers) is base 10.psychotomus wrote:but that only returns the RGB values and not HTML values. How can I convert the RGB values to an HTML value?
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.