ImageDra绘制二维图像

 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()

 

posted @ 2020-05-19 17:33  小他_W  阅读(155)  评论(0编辑  收藏  举报