#generate

captcha

Library for generating CAPTCHAs

9 releases

Uses old Rust 2015

0.0.9 May 17, 2022
0.0.8 Nov 3, 2020
0.0.7 May 16, 2017

#518 in Web programming

Download history 2921/week @ 2023-11-20 3181/week @ 2023-11-27 3164/week @ 2023-12-04 3590/week @ 2023-12-11 3199/week @ 2023-12-18 1328/week @ 2023-12-25 2372/week @ 2024-01-01 3033/week @ 2024-01-08 2879/week @ 2024-01-15 3341/week @ 2024-01-22 2482/week @ 2024-01-29 2673/week @ 2024-02-05 2847/week @ 2024-02-12 3262/week @ 2024-02-19 3114/week @ 2024-02-26 2793/week @ 2024-03-04

12,156 downloads per month
Used in 8 crates (7 directly)

Custom license

2MB
809 lines

CAPTCHA library written in Rust

Build Status

A library to generate CAPTCHAs like these:

captcha   captcha   captcha

Requirements

Rust (https://www.rust-lang.org/)

Documentation

https://docs.rs/captcha

Usage

Add the following dependency to the Cargo.toml file:

[dependencies]
captcha = "*"

In your source file do:

extern crate captcha;

use captcha::Captcha;
use captcha::filters::Noise;
use std::path::Path;

fn main() {
    Captcha::new()
        .add_chars(5)
        .apply_filter(Noise::new(0.1))
        .view(220, 120)
        .save(Path::new("/tmp/captcha.png"))
        .expect("save failed");
}

Running the example

git clone git@github.com:daniel-e/captcha.git
cd captcha
cargo run --example captcha

This example creates 12 CAPTCHA images (PNG images) in the current directory.

The generated images will look like the following three images:

captcha   captcha   captcha

Dependencies

~12MB
~79K SLoC