GD module is an interface to the GD library written by Thomas Bouttel.

gd is a graphics library. It allows your code to quickly draw images complete with lines, arcs, text, multiple colors, cut and paste from other images, and flood fills, and write out the result as a PNG or JPEG file. This is particularly useful in World Wide Web applications, where PNG and JPEG are two of the formats accepted for inline images by most browsers.

GD module homepage

Chris Gonnerman writes:

I am the current maintainer of the Python gdmodule. I took it over because I needed to annotate graphic images using TrueType fonts. The PIL (PythonImagingLibrary) is probably superior otherwise, but the font support stinks.

There are two other projects, claimed to be PIL-compatible, one supporting FreeType (TrueType) and the other supporting Postscript Type 1; but when I asked here previously for examples and/or support using either of them I got resounding silence.

PIL can be found at

The Image-SIG's t1python module is at (Incidentally this may have been updated since I first looked at it, so my complaints here may no longer apply.)

Robert Kern's PyFT can be found at

PIL Plus from Pythonware includes TrueType support (I've read) but as a commercial product it was not an option for my project.

I looked for the gdmodule, and discovered Richard Jones wasn't supporting it anymore. When I asked about taking it over, he answered "Sure, go ahead."

So I did. With help from others I have updated it to support the 2.01 (beta) libgd. There are weaknesses, in particular the terrible JPEG output (rule 1: always use PNG with the gdmodule), but at least all my TTF fonts work.

gdmodule also has a very simple interface; I don't have to know as much about an image file to work with it. This may be related to the crummy JPEG output... I dunno.

I'd love to see sample code to render either type of fonts via PIL and one or more of the above libraries. In fact, it seems like an ideal thing for a HOWTO or some such.

PyGdModule (last edited 2008-11-15 14:00:53 by localhost)

Unable to edit the page? See the FrontPage for instructions.