captchaimage

Create captcha image data
Download

captchaimage Ranking & Summary

Advertisement

  • Rating:
  • License:
  • Public Domain
  • Price:
  • FREE
  • Publisher Name:
  • Fredrik Portstrom
  • Publisher web site:
  • http://fredrik.jemla.eu/

captchaimage Tags


captchaimage Description

Create captcha image data captchaimage is a fast and easy to use Python library 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. python-captchaimage generates about 950 images a second on a 1800 MHz Intel Celeron.Installation:python-captchaimage uses distutils.python-captchaimage requires the library Freetype 2. http://freetype.orgTo build: ./setup.py buildTo build and install: ./setup.py installExample: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 captchaimageimport cStringIOimport Imagedef 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() Requirements: · Python What's New in This Release: · Fixed reference to the wrong variable. Updated URL.


captchaimage Related Software