Generating images with text in them

Terry Hancock hancock at anansispaceworks.com
Thu Jul 21 03:44:03 EDT 2005


On Wednesday 20 July 2005 11:59 pm, phil hunt wrote:
> 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.

On the fly, or just during development?

In any case, you should be aware of the Skencil vector graphic
program which is written in Python (with some C extensions),
and which is also, of course, a python vector-graphics library.

Unfortunately, getting it to work in a server environment might
not be too pretty (requires GTK, etc, even if you don't actually
use it).  I tried to make a stripped down version that didn't
require the desktop stuff, but it hasn't worked out so well yet.

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

I believe there is a utility for converting other types of fonts, you
might have to go through a couple of different conversions from
the font files you have.

> 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.

While bitmap font files are not copyrightable, there are license issues
with most of the "nicer" fonts you are probably talking about. That
complicates bundling them with the software. The PIL site does
actually have some additional fonts for download, though, IIRC.

--
Terry Hancock ( hancock at anansispaceworks.com )
Anansi Spaceworks  http://www.anansispaceworks.com




More information about the Python-list mailing list