Jesse's Development Blog: September 2009 Archive

Simple word wrapping algorithm for Python's PIL

Sept. 5th, 2009

I recently found a need to use the Python Imaging library (PIL) to generate images containing sizable amounts of text. PIL is a very basic image library and has no support for typesetting. This is how I implemented the minimum length (greedy) algorithm, as detailed on Wikipedia.

All content licensed under a Creative Commons Attribution-Share Alike 3.0 License unless otherwise noted.