The gen_captcha function generates an image containing text thats easy for a human to read, but difficult for a computer. This allows you create a test to tell humans and computers apart. (requires PIL)
Python, 39 lines
A CAPTCHA (Completely Automated Public Turing test to Tell Computers and Humans Apart) is a type of challenge and response test used tell humans and computers apart. This could be used to prevent "bots" from accessing online resources, taking part in online polls, signing up for free accounts, etc...
You must provide your own TrueType font(s); it works best if you use odd or irregular shaped fonts. You could even randomly choose a font for each captcha.