Skip to content

Commit

Permalink
Merge pull request #15 from VilNeo/patch-1
Browse files Browse the repository at this point in the history
  • Loading branch information
samirdjelal committed Aug 27, 2023
2 parents d7ce9a4 + d882714 commit 090c8ca
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
//! ```
use image::DynamicImage;
use imageproc::noise::{gaussian_noise_mut, salt_and_pepper_noise_mut};
use rand::Rng;

use crate::captcha::{cyclic_write_character, draw_interference_ellipse, draw_interference_line, get_image, to_base64_str};

Expand Down Expand Up @@ -125,8 +126,9 @@ impl CaptchaBuilder {
draw_interference_ellipse(2, &mut image, dark_mode);

if complexity > 1 {
gaussian_noise_mut(&mut image, (complexity - 1) as f64, ((5 * complexity) - 5) as f64, ((5 * complexity) - 5) as u64);
salt_and_pepper_noise_mut(&mut image, (0.002 * complexity as f64) - 0.002, (0.5 * complexity as f64) as u64);
let mut rng = rand::thread_rng();
gaussian_noise_mut(&mut image, (complexity - 1) as f64, ((5 * complexity) - 5) as f64, rng.gen());
salt_and_pepper_noise_mut(&mut image, (0.002 * complexity as f64) - 0.002, rng.gen());
}

Captcha {
Expand Down

0 comments on commit 090c8ca

Please sign in to comment.