No project description provided
Project description
基于pillow的简单文本转图片渲染工具
示例代码:
from easy_wrap import Drawer
text = "... the text you want to render ....测试自动换行"
font_path = "msyh.ttc"
font_size = 30
drawer = Drawer(font_path, font_size)
image_width = 180
canvas = drawer.draw_text(text, image_width)
# save the image
canvas.save(open("test.png", "wb"))
特性:
- 快速,800字平均渲染时长为0.04s(i7 cpu 2.7GHz)
- 遵循如下换行规则(与css word-break: normal 稍有差异)
- 纯中文:自动换行,一个汉字看做一个单词;
- 纯英文:看做一个单词,不换行;
- 遇到英文空格或者换行符:会换行;
更新日志
0.1.0
- 第一个可用版本
0.1.1
- 修复BUG:修复3.10以下python环境调用easy_wrap发生
TypeError: 'type' object is not subscriptable
的问题
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
easy_wrap-0.1.1.tar.gz
(3.1 kB
view details)
Built Distribution
File details
Details for the file easy_wrap-0.1.1.tar.gz
.
File metadata
- Download URL: easy_wrap-0.1.1.tar.gz
- Upload date:
- Size: 3.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.3.1 CPython/3.10.9 Windows/10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7d54b592bb1868bbad25c5bbcde953b7e9f5bf20e8e5897ca0043286bb96e7c3 |
|
MD5 | 64a8d3cc7ee68eaa69d5f325d0c0d5bc |
|
BLAKE2b-256 | 2bc1ce607a43f57c6b8ef4b069ac608e0411390ba0028c126b43a9e5fd5d7dac |
File details
Details for the file easy_wrap-0.1.1-py3-none-any.whl
.
File metadata
- Download URL: easy_wrap-0.1.1-py3-none-any.whl
- Upload date:
- Size: 3.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.3.1 CPython/3.10.9 Windows/10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 323165d5be565daab21e3ed0b496ea579c675e68195b863e527bace60f78a111 |
|
MD5 | 2b6602141ffff3a51ee3b7eb2470d615 |
|
BLAKE2b-256 | ed52900015c2d1a5b7ecc0581157d3a61a4644ad2cf20986d810c173f2f13875 |