Crates.io | captcha |
lib.rs | captcha |
version | 0.0.9 |
source | src |
created_at | 2017-05-10 11:26:37.150888 |
updated_at | 2022-05-17 06:29:50.351873 |
description | Library for generating CAPTCHAs. |
homepage | https://github.com/daniel-e/captcha |
repository | https://github.com/daniel-e/captcha |
max_upload_size | |
id | 13995 |
size | 4,501,335 |
A library to generate CAPTCHAs like these:
Rust (https://www.rust-lang.org/)
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");
}
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: