Python module code written in the usual study
1. Simple Verification Code
1 ImportImage, Imagedraw, Imagefont, ImageFilter2 ImportRandom3 4 defRNDCHR ():5 returnChr (Random.randint (48, 57))6 7 defRndcolor ():8 return(Random.randint (64,255), Random.randint (255), Random.randint (64,255))9 Ten defRndColor2 (): One return(Random.randint (127), Random.randint (32,127), Random.randint (32,127)) A -width = 60*4 -Height = 60 theImage = Image.new ('RGB', (width, height), (255, 255, 255)) -Font = Imagefont.truetype ('F:\\arial\\arial.ttf', 36) -Draw =Imagedraw.draw (image) - forXinchRange (width): + forYinchRange (height): -Draw.point ((x, y), fill =Rndcolor ()) + A forTinchRange (4): atDraw.text ((60*t+10, Ten), RNDCHR (), font = font, fill=RndColor2 ()) - -Image =Image.filter (Imagefilter.blur) -Image.Save ('f:\\arial\\code.jpg','JPEG')View Code
Python Common Code