-
Notifications
You must be signed in to change notification settings - Fork 21
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Can you support generating a captcha by specific text instead of random text? #20
Comments
Hi, guys, I support this question |
@omega4github , I found only this example of captcha generation from predefined symbols: extern crate captcha;
use captcha::filters::{Cow, Noise, Wave};
use captcha::{Captcha, Geometry};
use std::path::Path;
fn main() {
let mut c = Captcha::new();
println!("{:?}", c.supported_chars());
c.set_chars(&['0', '1', '2', '3', '4', '5', '6', '7', '8'])
.add_chars(4)
.apply_filter(Noise::new(0.2))
.apply_filter(Wave::new(2.0, 20.0))
.view(220, 120)
.apply_filter(
Cow::new()
.min_radius(40)
.max_radius(50)
.circles(1)
.area(Geometry::new(40, 150, 50, 70)),
)
.set_color([255, 128, 0]);
c.save(Path::new("captcha.png")).expect("save failed");
println!("{}", c.chars_as_string());
} |
Try implementing something like this:
|
To be clear, this generates a captcha with 4 characters randomly selected from the set_chars list. There doesn't appear to be a built-in way to explicitly set the exact character sequence used for generation. Unless you do something crazy like this?
|
I didn't find way to generate a captcha by specific text,can you add the support?
The text was updated successfully, but these errors were encountered: