From 97a8696472121261aaa3968c0118521fc956f6c6 Mon Sep 17 00:00:00 2001 From: borg <770188954@qq.com> Date: Fri, 23 Mar 2018 11:20:07 +0800 Subject: [PATCH] randomly add space between characters --- captcha/image.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/captcha/image.py b/captcha/image.py index e122621..86ef82e 100644 --- a/captcha/image.py +++ b/captcha/image.py @@ -194,6 +194,8 @@ class ImageCaptcha(_Captcha): images = [] for c in chars: + if random.random() > 0.5: + images.append(_draw_character(" ")) images.append(_draw_character(c)) text_width = sum([im.size[0] for im in images])