Generating images with text in them

phil hunt zen19725 at zen.co.uk
Thu Jul 21 00:59:58 EDT 2005


I am trying to generate some images (gifs or pngs) with text in 
them. I can use the Python Imaging Library, but it only has access 
to the default, rather crappy, font. 

Ideally I'd like to use one of the nicer fonts that come with my X 
Windows installation. Using Tkinter I can draw these fonts on the 
screen; is there any way to get these fonts into a bitmapped image?
For example, can I draw some text on a canvas and then "grab" that 
canvas as a bitmap into PIL, and then save it as a file?

Alternately, is there a good source of PIL font files (.pil files)
somewhere?

If the writers of the Python Imaging Library are reading this, may I 
suggest that they add more fonts to it. Yes, that would increase 
the size, but these days disk space is cheap and programmer time
expensive.

-- 
Email: zen19725 at zen dot co dot uk





More information about the Python-list mailing list