一个模拟汉字书写的轻量级python库
handright的Python项目详细描述
右手
一个用于模拟中文手写的轻量级python库
Tutorial| Release Notes| Contributing
视野
揭示汉字书写的本质,并用它实现美观、简单、易用的界面。
算法
首先,在水平位置、竖直位置和字体大小三个自由度上,对每个字的整体做随机扰动。随后,在水平位置、竖直位置和旋转角度三个自由度上,对每个字的每个笔画做随机扰动。
安装
pip install handright
快速启动
fromPILimportImage,ImageFontfromhandrightimportTemplate,handwritetext="我能吞下玻璃而不伤身体。"template=Template(background=Image.new(mode="1",size=(1024,2048),color=1),font_size=100,font=ImageFont.truetype("path/to/my/font.ttf"),)forimageinhandwrite(text,template):image.show()
更多信息请参阅Tutorial。