Skip to main content

OCR-based solvers for noisy and grid-style image CAPTCHAs

Project description

captcha-solver

OCR-based Python library to solve two common image CAPTCHA styles. Ready for PyPI.

Requires Tesseract OCR installed on your system (not only the pytesseract pip package).


CAPTCHA types this library solves

1. Image CAPTCHA — solveImageCaptcha

Clear character row (e.g. 6 characters).

Noisy CAPTCHA example

2. Noisy CAPTCHA — solveImageNoiseCaptcha

Heavy background noise, diagonal lines, and speckles. Use when the text is obscured but still readable. Uses segmentation + per-character OCR. Returns one result or 25 candidate results to try until the form accepts one.

Grid CAPTCHA example


Install

pip install captcha-solver

System dependency: Install Tesseract OCR.

Platform Command
Ubuntu/Debian sudo apt-get install tesseract-ocr
macOS brew install tesseract
Windows Tesseract at UB Mannheim — then set TESSERACT_CMD to the executable path if needed.

Usage

Class-based API

from captcha_solver import CaptchaSolver

solver = CaptchaSolver()

# Image CAPTCHA → one result
text = solver.solveImageCaptcha("path/to/Image.png")

# Noise CAPTCHA → one result (optional: num_chars, uppercase)
text = solver.solveImageNoiseCaptcha("path/to/noisy_captcha.png")

# Grid CAPTCHA → 25 candidate results (try each until form accepts)
results = solver.solve_grid_five_results("path/to/noisy_captcha.png")
for i, r in enumerate(results, 1):
    print(f"{i}: {r}")

Optional: Tesseract path (e.g. Windows)

import os
os.environ["TESSERACT_CMD"] = r"C:\Program Files\Tesseract-OCR\tesseract.exe"

from captcha_solver import CaptchaSolver
solver = CaptchaSolver()
# ... use as above

Grid solver options

Parameter Type Default Description
num_chars int | None 5 Expected number of characters; result is trimmed/padded to this length.
uppercase bool True If True, return uppercase; if False, return lowercase.

Publish to PyPI

# Install build and twine
pip install build twine

# Build package
python -m build

# Upload to Test PyPI (optional)
twine upload --repository testpypi dist/*

# Upload to PyPI
twine upload dist/*

Development

git clone https://github.com/yourusername/captcha-solver
cd captcha-solver
pip install -e ".[dev]"

License

MIT.

Project details


Download files

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

Source Distribution

captcha_vision_engine-0.1.0.tar.gz (13.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

captcha_vision_engine-0.1.0-py3-none-any.whl (14.2 kB view details)

Uploaded Python 3

File details

Details for the file captcha_vision_engine-0.1.0.tar.gz.

File metadata

  • Download URL: captcha_vision_engine-0.1.0.tar.gz
  • Upload date:
  • Size: 13.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for captcha_vision_engine-0.1.0.tar.gz
Algorithm Hash digest
SHA256 b3c56658c7f0a6d79324b2ad66c2fa5577d0300b7cbaf7e407c75873315ce7c5
MD5 1963b9105ade6c873b0c6e34f54d09a7
BLAKE2b-256 bcf66c561c622f19cb87581dcae420f03fab2c6e50935d83dc954cd0568b6060

See more details on using hashes here.

File details

Details for the file captcha_vision_engine-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for captcha_vision_engine-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a5c9b2a264f53632d79da6ebcfd8b63b24499e6d13831ef8dea4c69f8e797023
MD5 8ef1272ca3cde62d02bfeb317e38d086
BLAKE2b-256 255146aa1de10ea40fe8d3db8e4153c5f2907a8d851276154e873e223b6de650

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page