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

duppy1年前 ⋅ 461 阅读

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

    

    1. 友善是交流的起点。
    2. 请尽量使用Chrome浏览器(手机端遇到不兼容其他浏览器的情况请使用简单编辑器)。
    3. 同一条评论中多@其他人更容易得到Time。
    4. 支持直接粘贴图片(gif等动图不支持复制粘贴到文本框,需手动保存后上传才可显示)。

    相关推荐