This image was created with PIL. See how the g\'s and the y\'s are cut off in this image? How can I prevent this?
http://img109.imageshack.us/img109/8874/screenshote
My suggestion is, before you create the image object, to get the required size for the text.
This is done using font.getsize("text") (documentation).
In a image generating script I made, I first found the maximum height of one line of text, by calling the equvalient of font.getsize("Åj") (If you only need US-ASCII, you could find the height of "Aj" instead). Then I calculated the required image height and line offsets, including margins and line-spacing.