啦啦啦
Posted saolv
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了啦啦啦相关的知识,希望对你有一定的参考价值。
from PIL import Image, ImageDraw, ImageFont, ImageFilter import random # 随机字母: def rndChar(): return chr(random.randint(65, 90)) # 随机颜色1: def rndColor(): return (random.randint(64, 255), random.randint(64, 255), random.randint(64, 255)) # 随机颜色2: def rndColor2(): return (random.randint(32, 127), random.randint(32, 127), random.randint(32, 127)) # 240 x 60: width = 60 * 4 height = 60 image = Image.new(‘RGB‘, (width, height), (255, 255, 255)) font = ImageFont.truetype(‘Arial.ttf‘, 36) draw = ImageDraw.Draw(image) for x in range(width): for y in range(height): draw.point((x, y), fill=rndColor()) for t in range(4): draw.text((60 * t + 10, 10), rndChar(), font=font, fill=rndColor2()) image = image.filter(ImageFilter.BLUR) image.save(‘code.jpg‘, ‘jpeg‘)
以上是关于啦啦啦的主要内容,如果未能解决你的问题,请参考以下文章