From PIL import Image, Imagedraw, Imagefont, ImageFilter
Import Random
# Random Letters:
Def Rndchar ():
Return Chr (Random.randint (65, 90))
# Random Color 1:
Def rndcolor ():
Return (Random.randint, 255), Random.randint (255), Random.randint (64, 255))
# Random Color 2:
Def rndColor2 ():
Return (Random.randint (127), Random.randint (127), Random.randint (32, 127))
# x 60:
width = 60 * 4
Height = 60
Image = Image.new (' RGB ', (width, height), (255, 255, 255))
# Create a Font object:
Font = Imagefont.truetype (' C:\Windows\Fonts\Arial.ttf ', 36)
# Create Draw object:
Draw = Imagedraw.draw (image)
# Populate each pixel:
For x in range (width):
For y in range (height):
Draw.point ((x, y), Fill=rndcolor ())
# Output Text:
For T in range (4):
Draw.text ((* t + ten), Rndchar (), Font=font, Fill=rndcolor2 ())
Fuzzy
Image = Image.filter (Imagefilter.blur)
#image. Save (' code.jpg ', ' jpeg ')
Image.show (' code.jpg ', ' jpeg ')
Python Verification Code