张沈鹏修改版,为一个精选的英文字体做了微调,并加入了散点噪音
_______________________________
captchaimage 1.1 - Python extension to generate captcha images

2008 Fredrik Portstrom

I, the copyright holder of this file, hereby release it into the
public domain. This applies worldwide. In case this is not legally
possible: I grant anyone the right to use this work for any
purpose, without any conditions, unless such conditions are
required by law.

Introduction
============

captchaimage is a fast and easy to use Python extension for creating
images with distorted text that are easy for humans and difficult for
computers to read. Glyphs are loaded as bezier curves using Freetype,
rotated and scaled randomly, and then distorted by adding Perlin noise
to each point of the curve before rendering into a bitmap.
captchaimage generates about 950 images a second on a 1800 MHz Intel
Celeron.

Installation
============

captchaimage uses distutils.
captchaimage requires the library Freetype 2. http://freetype.org
To build: ./setup build
To build and install: ./setup install

Example
=======

To get a string containing a JPEG formatted image: It as a number
of lines, but it's just to copy and paste, and maybe change the
font face.

import captchaimage
import cStringIO
import Image

def get_captcha_image(code):
    size_y = 32
    image_data = captchaimage.create_image(
        "/usr/share/fonts/truetype/freefont/FreeSerif.ttf", 28, size_y, code)
    file = cStringIO.StringIO()
    Image.fromstring(
        "L", (len(image_data) / size_y, size_y), image_data).save(
        file, "JPEG", quality = 30)
    return file.getvalue()

Change log
==========

1.1 (2008-09-13) - Fixed bug causing captchaimage to crash.

1.0 (2008-07-30) - Initial release.
