https://github.com/daniel-e/captcha
CAPTCHA library written in Rust.
https://github.com/daniel-e/captcha
captcha captcha-library rust
Last synced: 4 months ago
JSON representation
CAPTCHA library written in Rust.
- Host: GitHub
- URL: https://github.com/daniel-e/captcha
- Owner: daniel-e
- License: mit
- Created: 2017-05-10T11:35:51.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2025-03-19T21:15:06.000Z (about 1 year ago)
- Last Synced: 2025-10-24T09:38:22.669Z (6 months ago)
- Topics: captcha, captcha-library, rust
- Language: Rust
- Size: 2.21 MB
- Stars: 108
- Watchers: 3
- Forks: 22
- Open Issues: 10
-
Metadata Files:
- Readme: README.md
- Changelog: ChangeLog
- License: LICENSE.md
Awesome Lists containing this project
README
# CAPTCHA library written in Rust
[](https://travis-ci.org/daniel-e/captcha)
[](https://github.com/daniel-e/captcha/blob/master/LICENSE.md)
[](https://github.com/daniel-e/captcha/stargazers)
[](https://deps.rs/repo/github/daniel-e/captcha)
A library to generate CAPTCHAs like these:
  
### Requirements
Rust (https://www.rust-lang.org/)
### Documentation
https://docs.rs/captcha
## Usage
Add the following dependency to the `Cargo.toml` file:
```toml
[dependencies]
captcha = "*"
```
In your source file do:
```rust
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:
 
