一个模拟中文手写的轻量级Python库

duppy1年前 ⋅ 2366 阅读

https://github.com/Gsllchb/Handright

pip install handright
# coding: utf-8
from PIL import Image, ImageFont

from handright import Template, handwrite

text = "我能吞下玻璃而不伤身体。"
template = Template(
    background=Image.new(mode="1", size=(1024, 2048), color=1),
    font=ImageFont.truetype("path/to/my/font.ttf", size=100),
)
images = handwrite(text, template)
for im in images:
    assert isinstance(im, Image.Image)
    im.show()


全部评论: 0

    相关推荐