文字を描く

2017/01/24

Python2.7.10, PIL1.1.7

from PIL import Image, ImageDraw, ImageFont

im = Image.new('RGB',(200,50),(255,255,255))
draw = ImageDraw.Draw(im)
font_path = r'C:\Windows\Fonts\msgothic.ttc'
font_size = 16
font = ImageFont.truetype(font_path,font_size)
pos = (5,5)
text = 'Hello World'
color = (0,0,0)
draw.text(pos,text,color,font)
im.show()