[Image-SIG] How to specify the color of a text

Michele Petrazzo - Unipex srl michele.petrazzo at unipex.it
Wed Apr 30 23:04:27 CEST 2008


cafeeee wrote:
> I failed to specify the color of the text while drawing a text into an
> image:
> 
>>>> import Image, ImageDraw, ImageColor, ImageFont
>>>> image = Image.open("a.gif")
>>>> draw = ImageDraw.Draw(image)
>>>> font = ImageFont.truetype("arial.ttf", 15)
>>>> color = "blue"
>>>> draw.text((10, 10), "HELLO", fill=color, font=font)

 >>> color = 0,0,0
 >>> draw.text((10, 10), "HELLO", fill=color)


Here you can find all the PIL doc:
http://www.pythonware.com/library/pil/handbook/imagedraw.htm


More information about the Image-SIG mailing list