Issue #3 new

problem with result image(crop)

Anonymous created an issue

image is cropped, look attachments

Comments (1)

  1. dobo_pl

    It's related to this python-pillow issue https://github.com/python-pillow/Pillow/issues/644.

    Applying this patch renders text properly:

    diff -rupN wheezy.captcha/src/wheezy/captcha/image.py wheezy.captchap/src/wheezy/captcha/image.py
    --- wheezy.captcha/src/wheezy/captcha/image.py  2014-06-15 00:20:19.074699720 +0200
    +++ wheezy.captchap/src/wheezy/captcha/image.py 2014-06-15 00:21:58.289567379 +0200
    @@ -95,7 +95,8 @@ def text(fonts, font_sizes=None, drawing
             for c in text:
                 font = random.choice(fonts)
                 c_width, c_height = draw.textsize(c, font=font)
    -            char_image = Image.new('RGB', (c_width, c_height), (0, 0, 0))
    +            o_width, o_height = font.getoffset(c)
    +            char_image = Image.new('RGB', (c_width + o_width, c_height + o_height), (0, 0, 0))
                 char_draw = Draw(char_image)
                 char_draw.text((0, 0), c, font=font, fill=color())
                 char_image = char_image.crop(char_image.getbbox())
    
  2. Log in to comment