[Image-SIG] Creating text on images

Dmitry Vasiliev lists at hlabs.spb.ru
Thu Jan 13 09:00:43 CET 2005

Morten W. Petersen wrote:
> Hi all,
> I'm trying to create a script that will superimpose text on an image. I 
> didn't find any great examples out there on how this can be done (I 
> presume using PIL is necessary), do you know of any examples?

You can do it like this:

 >>> from PIL import Image, ImageDraw
 >>> image = Image.new("L", (100, 50))
 >>> draw = ImageDraw.Draw(image)
 >>> draw.text((10, 10), "Hello, World!", fill=0xff)
 >>> image.show()

See also ImageFont module.

Dmitry Vasiliev (dima at hlabs.spb.ru)

More information about the Image-SIG mailing list