diff --git a/src/captcha/image.py b/src/captcha/image.py index ecc43f7..84de254 100644 --- a/src/captcha/image.py +++ b/src/captcha/image.py @@ -103,7 +103,10 @@ class ImageCaptcha: draw: ImageDraw, color: ColorTuple) -> Image: font = random.choice(self.truefonts) - _, _, w, h = draw.textbbox((1, 1), c, font=font) + + left, top, right, bottom = draw.textbbox((0, 0), c, font=font) + w = int((right - left)*1.7) or 1 + h = int((bottom - top)*1.7) or 1 dx1 = random.randint(0, 4) dy1 = random.randint(0, 6)