[Image-SIG] Re: ImageDraw colors (was: Misc observations...)
Fredrik Lundh
fredrik@pythonware.com
Mon, 14 Apr 2003 00:23:42 +0200
Cameron Blackwood wrote:
> ImageDraw
> ---------
> Giving that working out the actual colors seems to be
> secret hacker knowledge (I guess it had to be RGB or BGR so
> its not that secret ;), but why not have a method like color32(r,g,b)
> that returned the 'magic int' that is needed for 32 bit colors?
>
> Ie:
> draw.line( ((10,10),(200,200)), fill=draw.color_rgb(200,10,50) )
> is neater than:
> draw.line( ((10,10),(200,200)), fill=(b<<16)+(g<<8)+r )
using a tuple is even easier:
draw.line( (10,10,200,200), fill=(200,10,50) )
in 1.1.4, you can use CSS3-style colour names as well; see
http://www.effbot.org/zone/pil-imagedraw.htm
</F>