9 releases

Uses old Rust 2015

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

#594 in Web programming

Download history 5741/week @ 2024-08-14 5928/week @ 2024-08-21 4460/week @ 2024-08-28 6161/week @ 2024-09-04 5749/week @ 2024-09-11 5539/week @ 2024-09-18 6606/week @ 2024-09-25 6658/week @ 2024-10-02 5935/week @ 2024-10-09 7160/week @ 2024-10-16 6050/week @ 2024-10-23 5705/week @ 2024-10-30 4983/week @ 2024-11-06 7381/week @ 2024-11-13 6122/week @ 2024-11-20 2897/week @ 2024-11-27

22,554 downloads per month
Used in 11 crates (9 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

~4.5MB
~86K SLoC