将任何图像转换为符合六角贴纸标准的图像。
项目描述
从符合贴纸标准的图像自动生成六边形贴纸。
安装
$ pip install hexsticker
在上面列出的安装步骤之后,您将能够使用hexsticker命令:
$ hexsticker --help
要求
Python 3.6+
例子
让我们为Selinon 项目创建一个六边形贴纸。
这是输入图像:
<figure class="align-center">让我们创建一个六边形贴纸:
$ hexsticker selinon.png -o selinon-sticker-1.png
INFO:hexsticker.create:Writing output to 'selinon-sticker-1.png'
生成的图像是:
<figure class="align-center">如上所示,有一些部分被切断了——让我们为图像添加一些填充:
$ hexsticker input/selinon.png -o output/selinon-sticker-2.png --padding-size 25
INFO:hexsticker.create:Writing output to 'selinon-sticker-2.png'
<figure class="align-center">
默认情况下,填充部分是白色的 - 这就是为什么缺少六边形尖峰的原因。让我们将填充区域的颜色设置为与原始图像的背景颜色相同的颜色:
$ hexsticker input/selinon.png -o output/selinon-sticker-3.png --padding-size 25 --padding-color '#66cfa7'
INFO:hexsticker.create:Writing output to 'selinon-sticker-3.png'
<figure class="align-center">
好的!我们接下来能做什么?让我们尝试添加一个六边形边框:
$ hexsticker input/selinon.png -o output/selinon-sticker-4.png --padding-size 25 --padding-color '#66cfa7' --border-size 35
INFO:hexsticker.create:Writing output to 'selinon-sticker-4.png'
<figure class="align-center">
嗯,在这种情况下,默认的黑色看起来不太好。让我们尝试一些适合配色方案的颜色:
$ hexsticker input/selinon.png -o output/selinon-sticker-5.png --padding-size 25 --padding-color '#66cfa7' --border-size 35 --border-color '#197a9f'
INFO:hexsticker.create:Writing output to 'selinon-sticker-5.png'
<figure class="align-center">
请注意,六边形的边缘看起来有点锯齿状。您可以在前面的命令中添加--supersample 2来解决这个问题。给定的数字设置要使用的比例因子。更大的值会导致更平滑的结果,但代价是更高的内存使用率。这种效应的收益递减;通常值 2 就足以获得不错的结果,高于 4 并不会带来太大的改善。
如您所见,此工具可以自动创建六边形贴纸,因此它们遵守六边形标准。随意额外调整您的徽标或输入图像的结果图像。
此工具仅支持光栅图形。
从回购运行
要从存储库运行 hexsticker,请运行以下命令:
$ git clone https://github.com/fridex/hexsticker # or use ssh
$ cd hexsticker
$ pip3 install -r requirements.txt --user
$ export PYTHONPATH='.'
$ ./hexsticker-cli --help
项目详情
下载文件
下载适用于您平台的文件。如果您不确定要选择哪个,请了解有关安装包的更多信息。
源分布
hexsticker-1.2.0.tar.gz
(6.6 kB
查看哈希)
内置分布
hexsticker-1.2.0-py3-none-any.whl
(14.2 kB
查看哈希)
关
hexsticker -1.2.0.tar.gz 的哈希值
| 算法 | 哈希摘要 | |
|---|---|---|
| SHA256 | 1e328c8d652a05ed829e66f56b7dc8a9f20fa91a16c5b0fa914f7f423692696b |
|
| MD5 | 51933ebbe06cde0513c9be9441b1460d |
|
| 布莱克2-256 | c082ebde0cafbe52da5102e932cb2bce12e939ee0113620bfcc3aa555b4db881 |
关
hexsticker -1.2.0-py3-none-any.whl 的哈希值
| 算法 | 哈希摘要 | |
|---|---|---|
| SHA256 | 28aac200b57dd4eabf102c78e0d6254cc893b5061fe11d7f157ee9c72b497de4 |
|
| MD5 | 505de8f8afc9ad50529c5c4dfb3946f9 |
|
| 布莱克2-256 | e0f46779631ff7e4a0ddfbecdebd54b44c0cb1fe229cee520441c83b66dda48f |