Mitja> They're called captcha images or captchas for short. Googling
Mitja> for "python captcha" returns several hits; see what you like...
Thanks. I'd never heard that term before. Assuming I can get PIL installed
with freetype support on my Mac the ASPN recipe looks like it will do the
trick.
Keep in mind two serious problems with captchas:
- they're impossible for the blind or people using text-only browsers to
see -- even mere colour blindness can make some captchas impossible to
solve;
- sometimes they're too difficult for even those with perfect vision to
decipher.
Two alternatives:
Instead of displaying an obfuscated image of a nonsense word, display six
randomly chosen photos, where five are of the same thing but not the same
image. E.g. you might show five different kittens and a horse. The user
has to click on the image that is not the same as the others.
State-of-the-art horse-recognition software is not yet in widespread use
by spammers *wink*
For a text only solution, consider putting up a natural language question
such as:
What is the third letter of 'national'?
What is four plus two?
How many eggs in a dozen?
Fill in the blank: Mary had a little ____ its fleece was white as snow.
Cat, Dog, Apple, Bird. One of those words is a fruit. Which one?
Beware of making the questions too difficult or too specific:
In the third season of Babylon Five, what did Mr Morden ask Lando?
Also, keep in mind that all captchas are vulnerable to the old
distributed hybrid human-machine network trick: "We'll give you a free
account on our porn site if you spend fifteen minutes a day solving
captchas for our bot network." The only solution to that, I fear, is open
season on spammers and anyone who buys from a spammer.