Metadata-Version: 2.0
Name: claptcha
Version: 0.3.1
Summary: A simple CAPTCHA image generator
Home-page: https://github.com/kuszaj/claptcha/
Author: Piotr Kuszaj
Author-email: peterkuszaj@gmail.com
License: MIT
Platform: UNKNOWN
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: MacOS :: MacOS X
Classifier: Operating System :: Microsoft :: Windows
Classifier: Operating System :: POSIX :: Linux
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.5
Classifier: Topic :: Multimedia :: Graphics
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Requires-Dist: Pillow


Simple CAPTCHA generator package.

This module provides a single class (Claptcha) that can create on the fly
PIL Image instances, BytesIO objects or save image files containing a simple
CAPTCHA strings. Its build on top of Pillow package.

It is required that user provides a TTF file with font to be used in images
and either a string with CAPTCHA text or a callable object returning strings
to be used in images.

Examples:

>>> from claptcha import Claptcha
>>>
>>> # Initialize Claptcha object
>>> c = Claptcha("Text", "FreeMono.ttf")
>>>
>>> # Create a PIL Image object, return it and provided text
>>> c.image
('Text', <PIL.Image.Image image mode=RGB size=200x80 at 0xB741406C>)
>>>
>>> # Create a BytesIO object, return it and provided text
>>> c.bytes
('Text', <_io.BytesIO object at 0xb71e87dc>)
>>>
>>> # Save image in 'claptcha.png' file, return its path and provided text
>>> c.write('claptcha.png')
('Text', 'test.png')
>>>
>>> def captchaStr():
...     return "TextFromFunc"
...
>>> # Redefine c: change its size to 100x30, use nearest resampling filter
>>> # and add white noise
>>> from PIL import Image
>>> c = Claptcha(captchaStr, "FreeMono.ttf", (100,30),
...              resampling=Image.NEAREST, noise=0.3)
>>> c.image
('TextFromFunc', <PIL.Image.Image image mode=RGB size=100x30 at 0xB73EE66C>)


