Skip to content

Latest commit

 

History

History
59 lines (41 loc) · 1.55 KB

README.md

File metadata and controls

59 lines (41 loc) · 1.55 KB

CAPTCHA library written in Rust

Build Status GitHub license GitHub stars dependency 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 [email protected]: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