标签:pil rectangle pre 图片 color ttf from rgb src
1 from PIL import Image,ImageDraw,ImageFont 2 img = Image.new(‘RGB‘,(300,300),‘white‘) 3 # img.show() 4 # 绘制一个矩形 5 draw_obj = ImageDraw.Draw(img) 6 draw_obj.rectangle((50,50,200,200),fill=‘blue‘,outline=‘red‘) 7 # draw_obj.text((60,80),‘Monsterlv‘,fill=‘green‘) 8 font = ImageFont.truetype(‘SIMLI.TTF‘,20) 9 draw_obj.text((80,80),‘小怪兽‘,font = font,fill=‘white‘) 10 img.show()
标签:pil rectangle pre 图片 color ttf from rgb src
原文地址:https://www.cnblogs.com/monsterhy123/p/12918297.html