随机物种化身生成
bvatar的Python项目详细描述
bvatar创建字符串的唯一8x8图形表示。
设置
从pypi安装
使用以下pip命令安装:
pip install bvatar
或者,如果希望能够创建位图图像,请改用此选项:
pip install bvatar[bitmap]
安装开发版本
从github下载并使用以下命令安装开发版本:
git clone https://github.com/smileychris/bvatar cd bvatar pip install -e .[bitmap]
用法
导入bvatar类并像这样使用:
from bvatar import Bvatar bvtr = Bvatar(‘text’) img = bvtr.image() img.save(‘some_file.png’, ‘PNG’)
命令行脚本
生成bvatar(8x8随机艺术化身)。
用法:
bvatar [--mirror] [--no-color] [--px-size=<int>] ([TEXT] | [--hash=<sha1_hash>]) bvatar --ascii [--mirror] [--spaced] [--no-border] ([TEXT] | [--hash=<sha1_hash>])
第一种格式是生成位图图像。默认情况下,图像是 只显示不存储。要保存图像,请通过管道发送到文件:
bvatar > some_file.png
参数:
- ^{tt1}$
- bvatar source text (otherwise a random bvatar is generated)
选项:
- ^{tt2}$
- generate a horizontally mirrored bvatar
- ^{tt3}$
- use greyscale rather than coloring the image
- ^{tt4}$
- actual size for each pixel [default: 16]
- ^{tt5}$
- rather than passing the text and having it SHA1ed, you can pass a hex encoded SHA1 hash explicitly
- ^{tt6}$
- output ascii rather than generating a bitmap image
- ^{tt7}$
- a “lighter” ascii art alternative
- ^{tt8}$
- don’t add a border around the ascii art