web/captcha.py
branch3.22
changeset 11431 bc473cddba5e
parent 11405 5ba55f4c813a
equal deleted inserted replaced
11405:5ba55f4c813a 11431:bc473cddba5e
    50     img = Image.new('RGB', (dim[0]+15, dim[1]+5), 0)
    50     img = Image.new('RGB', (dim[0]+15, dim[1]+5), 0)
    51     draw = ImageDraw.Draw(img)
    51     draw = ImageDraw.Draw(img)
    52     # draw 100 random colored boxes on the background
    52     # draw 100 random colored boxes on the background
    53     x, y = img.size
    53     x, y = img.size
    54     for num in range(100):
    54     for num in range(100):
    55     for num in xrange(100):
       
    56         fill = (randint(0, 100), randint(0, 100), randint(0, 100))
    55         fill = (randint(0, 100), randint(0, 100), randint(0, 100))
    57         draw.rectangle((randint(0, x), randint(0, y),
    56         draw.rectangle((randint(0, x), randint(0, y),
    58                         randint(0, x), randint(0, y)),
    57                         randint(0, x), randint(0, y)),
    59                        fill=fill)
    58                        fill=fill)
    60     # add the text to the image
    59     # add the text to the image