[Tutor] Getting hex value of pixels

Michael Miller blackmariah@shmups.com
Fri Jan 31 05:54:01 2003


I'm using PIL to build an ASCII art generator. Silly, but I'm learning here. 
;) It will take an input image, get the value of each pixel, then output an 
HTML file with random characters that have the color of each pixel. Sorry if 
that doesn't make much sense. I need to get the hexadecimal value of each 
pixel's color, but I'm having no luck doing so. hex() returns normal 
hexadecimal numbers, not those used for HTML colors (of course). The 
getpixel() method of PIL returns the RGB values. How can I go about getting 
the hex value of each pixel's color? Thanks in advance.

Michael