captcha-canvas API Documentation - v3.3.4
    Preparing search index...

    captcha-canvas API Documentation - v3.3.4

    captcha-canvas API Documentation

    A powerful and highly customizable CAPTCHA generator for Node.js applications, built on top of the fast skia-canvas rendering engine.

    const { createCaptchaSync, CaptchaGenerator } = require("captcha-canvas");

    // Simple generation
    const { image, text } = createCaptchaSync(300, 100);

    // Advanced generation with fluent API
    const captcha = new CaptchaGenerator()
    .setDimension(150, 400)
    .setCaptcha({ characters: 6, size: 60 })
    .setTrace({ color: "#ff0000" });

    const buffer = captcha.generateSync();
    • CaptchaGenerator - High-level fluent interface for CAPTCHA generation
    • Captcha - Low-level canvas manipulation and rendering
    • Dual API Design: Simple functions for quick use, classes for advanced control
    • Security Features: Trace lines, decoy characters, and visual distortions
    • Customizable Styling: Fonts, colors, rotation, skewing, and opacity control
    • Background Support: Custom background images (async generation only)
    • Multi-styled Text: Array-based text configuration with different styles per segment
    • TypeScript Ready: Full type definitions and IntelliSense support
    # Install peer dependency first
    npm install skia-canvas

    # Install captcha-canvas
    npm install captcha-canvas

    For detailed usage examples, integration patterns, and troubleshooting, see the complete documentation sections below.