char_art
方便地制作字符画与字符视频 ~
0. 引言
制作字符画和字符视频的脚本很多人都写过, 而我写该库的目的主要是为了:
- 让制作字符画与字符视频更方便, 只需一行命令即可完成从生成到保存的全部过程
- 做了许多优化, 让生成字符画和字符视频更加高效
1. 安装
使用以下命令安装该库, 使用该库的基本功能:
pip install char_art
若需要保存生成的字符画和字符视频, 则需要额外安装 pygame 库, 或者可以直接用以下命令进行安装
pip install char_art[save]
2. 快速开始
-
生成一张图片的字符画
python -m char_art display 'my_image.jpg' -s 120 37
-
生成一段视频的字符视频
python -m char_art display 'my_video.mp4' -v -s 80 30
-
保存生成的字符画 (需要 pygame 库)
python -m char_art save 'my_image.jpg' 'save_file.jpg' -s 120 37
-
保存生成的字符视频 (需要 pygame 库)
python -m char_art save 'my_video.mp4' 'save_file.mp4' -v -s 80 30
3. 使用帮助
usage: python -m char_art [-h] [-v] {display,save} ...
positional arguments:
{display,save}
display 展示字符画或字符视频
save 保存字符画为图像文件 / 字符视频为视频文件
options:
-h, --help show this help message and exit
-v, --version show program's version number and exit
usage: python -m char_art display [-h] [-v] -s WIDTH HEIGHT [-c CHARS] [-l] file
positional arguments:
file 图像或视频的文件路径
options:
-h, --help show this help message and exit
-v, --video 展示字符视频, 若不设置则为字符画
-s, --size WIDTH HEIGHT
字符画或字符视频的尺寸, 按字符数量计
-c, --chars CHARS 使用的字符序列 (默认为 ' .-+{#')
-l, --load 在展示字符视频前加载并缓存所有字符帧, 使得播放时更流畅
usage: python -m char_art save [-h] [-v] -s WIDTH HEIGHT [-c CHARS] [--font FONT] [--font-size FONT_SIZE] [--spacing SPACING] [--fill FILL] [--bg BG] [--scale SCALE] [--fourcc FOURCC]
file save_file
positional arguments:
file 图像或视频的文件路径
save_file 生成的图像或视频的保存路径
options:
-h, --help show this help message and exit
-v, --video 保存字符视频, 若不设置则为字符画
-s, --size WIDTH HEIGHT
字符画或字符视频的尺寸, 按字符数量计
-c, --chars CHARS 使用的字符序列 (默认为 ' .-+{#')
--font FONT 字体文件路径, **需要等宽字体** (默认为系统字体 Courier New)
--font-size FONT_SIZE
字体大小 (默认为 15)
--spacing SPACING 行间距 (默认为 0)
--fill FILL 字符前景色 (默认为白色 '#FFFFFF')
--bg BG 背景色 (默认为黑色 '#000000')
--scale SCALE 按比例缩放生成的图像或视频尺寸 (默认不缩放)
--fourcc FOURCC 视频编码器 (默认为 'mp4v')
Metadata
Release files for char-art 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| char_art-0.1.1.tar.gz | 11.1 kB | Without provenance | Details for char_art-0.1.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| char_art-0.1.1-py3-none-any.whl | Python 3 | none | any | Details for char_art-0.1.1-py3-none-any.whl |
Total release size: 22.5 kB
Release files / char_art-0.1.1.tar.gz
| Download URL | char_art-0.1.1.tar.gz |
|---|---|
| Size | 11.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
45eb0ed77a2a05df1982a1a87eba367f998fc52774f7e1e67fcf5c92d98df9e0
|
|
BLAKE2b-256 checksum How to use checksums |
ac72fdd05b6cea6101cd040b1e9ed2bbc3ab49d3de607ae8600de5f3a2b40789
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.0
|
Release files / char_art-0.1.1-py3-none-any.whl
| Download URL | char_art-0.1.1-py3-none-any.whl |
|---|---|
| Size | 11.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
43ebf972b401126cc59ab43cbb57981f2893a5ea17800edad90215af0e921799
|
|
BLAKE2b-256 checksum How to use checksums |
8a47ebfb5cf8c6b5f72a82ce666f830f017781cf5596af21e00292d2c92176fb
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.0
|
Security for char-art 0.1.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.