-
Notifications
You must be signed in to change notification settings - Fork 2
Core API
Sepehr0Day edited this page Jun 13, 2026
·
1 revision
All generators accept a CaptchaConfig in their constructor. Newer visual
generators may also accept a per-call config.
| Field | Default | Purpose |
|---|---|---|
width |
720 |
Output width |
height |
240 |
Output height |
output_format |
"PNG" |
PNG, JPEG, WEBP or GIF where supported |
quality |
92 |
JPEG/WEBP quality |
background_color |
light blue | Canvas background |
foreground_color |
dark blue | Text and outline color |
accent_colors |
five colors | Challenge palette |
fonts |
() |
Font file paths |
font_size |
None |
Optional fixed font size |
line_width |
3 |
Shape and outline width |
padding |
24 |
Safe canvas padding |
language |
"en" |
Integration language hint |
prompt |
None |
Override the generated prompt |
accessibility_text |
None |
Screen-reader description |
high_contrast |
False |
High-contrast preference |
include_answer_in_metadata |
False |
Debug only; never enable for clients |
random_seed |
None |
Reproducible generation |
pre_render_hook |
None |
Transform image before resize/save |
post_render_hook |
None |
Final watermark or image transform |
Most visual generators return:
@dataclass(frozen=True)
class ChallengeResult:
answer: object
path: str
prompt: str
metadata: dict[str, object]
accessibility_text: str
mime_type: strLegacy-style generators return strings or tuples. Their exact return values are documented on the category pages.
from CaptchaGenerator import SUPPORTED_CAPTCHAS
generator_type = SUPPORTED_CAPTCHAS["MazeCaptcha"]
generator = generator_type()Invalid parameters raise InvalidArgumentError. Optional dependency and
generation failures derive from CaptchaError.
- Home
- Installation
- Quick-Start
- Configuration
- Core-API
- Generator-API-Reference
- Core-Utilities
- Supported-CAPTCHAs
- All-Examples
- Text-and-Media-CAPTCHAs
- Logic-CAPTCHAs
- Image-CAPTCHAs
- Selection-CAPTCHAs
- Puzzle-CAPTCHAs
- Visual-Reasoning-CAPTCHAs
- Tkinter-Examples
- Web-Integration
- Architecture
- Creating-a-Generator
- Security
- Publishing
- Migration-to-2.0
- FAQ