Skip to main content
This is a pre-production deployment of Warehouse. Changes made here affect the production instance of PyPI (pypi.python.org).
Help us improve Python packaging - Donate today!

A library that generates image captcha.

Project Description
wsy_captcha
===================

A library that generates image captcha.

.. image:: https://raw.githubusercontent.com/wushuyi/wsy_captcha/master/test.png

Installation
------------

Install wsy_captcha with pip::

$ pip install wsy_captcha

Base Usage
-----
.. code:: python

from wsy_captcha.comp import print_
from wsy_captcha.captcha import Captcha

captcha = Captcha()
code = captcha.randomCode()
print_(code)
captcha.write(code, 'test.png')

Advanced Usage
-----
.. code:: python

from wsy_captcha.comp import print_
from wsy_captcha.captcha import Captcha
import wsy_captcha.image as image


class MyCaptcha(Captcha):
def generate_image(self, chars):
text_drawings = [
image.warp(),
image.rotate(),
image.offset(),
]
fn = image.captcha(
drawings=[
image.background(color='#FFFFFF'),
image.text(fonts=self._fonts, drawings=text_drawings),
image.curve(width=2),
image.curve(width=2),
image.curve(width=2),
image.noise(number=60, color='#5C87B2', level=2),
image.smooth(),
],
width=self._width,
height=self._height,
)
return fn(chars)


captcha = MyCaptcha()
code = captcha.randomCode()
img = captcha.generate(code)
print_(code)
f = open('test.png', 'wb')
f.write(img.read())
f.close()
Release History

Release History

This version
History Node

1.0.0

Download Files

Download Files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
wsy_captcha-1.0.0-py3-none-any.whl (61.6 kB) Copy SHA256 Checksum SHA256 3.4 Wheel Oct 7, 2015
wsy_captcha-1.0.0.tar.gz (59.8 kB) Copy SHA256 Checksum SHA256 Source Oct 7, 2015

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting