def extractFunction(font_loc):
white = (255, 255, 255)
# use a truetype font
font = ImageFont.truetype(font_loc, 280)
im = Image.new("RGB", (280, 280), white)
draw = ImageDraw.Draw(im)
for code in range(ord('a'), ord('z') + 1):
w, h = draw.textsize(chr(code), font=font)
im = Image.new("RGB", (w, h), white)
draw = ImageDraw.Draw(im)
draw.text((0, 0), chr(code), font=font, fill="#000000")
convert_im(code, im)
#im.save(chr(code) + str(time.time()) + ".png")
for code in range(ord('A'), ord('Z') + 1):
w, h = draw.textsize(chr(code), font=font)
im = Image.new("RGB", (w, h), white)
draw = ImageDraw.Draw(im)
draw.text((0, 0), chr(code), font=font, fill="#000000")
convert_im(code, im)
#im.save(chr(code) + str(time.time()) + ".png")
extract_font (TTF).py 文件源码
python
阅读 27
收藏 0
点赞 0
评论 0
评论列表
文章目录