Skip to main content

Python random image-captcha generator library.

Installation

To generate the images of the Captchas, the library uses Pillow module.

  1. For Linux systems, it is necessary to install Pillow prerequisites (also, Pillow and PIL cannot co-exist in the same environment. Before installing Pillow, please uninstall PIL):

$ apt-get install libtiff5-dev libjpeg8-dev zlib1g-dev libfreetype6-dev liblcms2-dev libwebp-dev tcl8.6-dev tk8.6-dev python3-tk
  1. Install the module

$ pip install multicolorcaptcha
  1. Try sample captcha

$ multicolorcaptchademo
  1. Look at the captchas/ folder.

API Usage

from multicolorcaptcha import CaptchaGenerator

# Captcha image size number (2 -> 640x360)
CAPCTHA_SIZE_NUM = 2

# Create Captcha Generator object of specified size
generator = CaptchaGenerator(CAPCTHA_SIZE_NUM)

# Generate a captcha image
captcha = generator.gen_captcha_image(difficult_level=3)
math_captcha = generator.gen_math_captcha_image(difficult_level=2)

# Get information of standard captcha
image = captcha["image"]
characters = captcha["characters"]

# Get information of math captcha
math_image = math_captcha["image"]
math_equation_string = math_captcha["equation_str"]
math_equation_result = math_captcha["equation_result"]

# Save the images to files
image.save("captcha.png", "png")
math_image.save("captcha.png", "png")

Generated Captchas Examples

Monocolor Background Captchas:

Monocolor Captcha

Multicolor Background Captchas:

Multicolor Captcha

ASCII Captchas:

Multicolor Captcha

Modificable Difficult Level Captchas:

Multicolor Captcha

Math Equation Captchas:

Math Captcha

Metadata

Release files for multicolorcaptcha 1.1.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for multicolorcaptcha 1.1.3
File Size Uploaded
multicolorcaptcha-1.1.3.tar.gz 10.3 MB Details

Built distribution (wheel)

Table of built distributions (wheels) for multicolorcaptcha 1.1.3
File Interpreter ABI Platform
multicolorcaptcha-1.1.3-py3-none-any.whl Python 3 none any Details

Total release size: 20.7 MB

Release files / multicolorcaptcha-1.1.3.tar.gz

Download URL multicolorcaptcha-1.1.3.tar.gz
Size 10.3 MB
Tags Source
SHA-256 checksum
How to use checksums
0d982c23580ee3ca5e91563dc6a93bfd76da040911b4b43c317004360900fe03
BLAKE2b-256 checksum
How to use checksums
310fede2dc04b5dc430ba7a70836f5e3e3ff65caca04425ed59318bc61f0de55
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.4.2 requests/2.22.0 setuptools/49.6.0 requests-toolbelt/0.8.0 tqdm/4.43.0 CPython/3.8.10

Release files / multicolorcaptcha-1.1.3-py3-none-any.whl

Download URL multicolorcaptcha-1.1.3-py3-none-any.whl
Size 10.4 MB
Tags Python 3
SHA-256 checksum
How to use checksums
4bd5d7857c41b3513689160e35eab9c2cdace0ae8d5a6b5b97071aa16e70a3d5
BLAKE2b-256 checksum
How to use checksums
14a38de72c1f83154b184cf8feefd9a46e92b1c30c8cb74d505b04ff128e4420
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.4.2 requests/2.22.0 setuptools/49.6.0 requests-toolbelt/0.8.0 tqdm/4.43.0 CPython/3.8.10

Release history Release notifications | RSS feed

1.2.0

2 release files

This release

1.1.3 This release

2 release files

1.1.2

2 release files

1.1.1

2 release files

1.1.0

2 release files

1.0.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page