将任何图像转换为符合六边形贴纸标准的图像。
hexsticker的Python项目详细描述
根据Stickers Standard从图像自动生成六边形贴纸。在
安装
$ pip install hexsticker
完成上面列出的安装步骤后,您将能够使用hexsticker命令:
^{pr2}$要求
- Python 3.6+
示例
让我们为Selinon project创建一个六边形贴纸。在
以下是输入图像:
让我们创建一个六边形贴纸:
$ hexsticker selinon.png -o selinon-sticker-1.png INFO:hexsticker.create:Writing output to 'selinon-sticker-1.png'
生成的图像是:
如上图所示,有一些部分被切断-让我们给图像添加一些填充:
$ hexsticker input/selinon.png -o output/selinon-sticker-2.png --padding-size 25INFO:hexsticker.create:Writing output to 'selinon-sticker-2.png'
填充的部分默认为白色-这就是为什么会缺少六边形尖头。让我们将填充区域的颜色设置为与原始图像的背景颜色相同的颜色:
$ 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'
不错!我们下一步该怎么办?让我们尝试添加一个六边形边框:
$ hexsticker input/selinon.png -o output/selinon-sticker-4.png --padding-size 25 --padding-color '#66cfa7' --border-size 35INFO:hexsticker.create:Writing output to 'selinon-sticker-4.png'
嗯,默认的黑色在这种情况下看起来不太好。让我们试试适合配色方案的颜色:
$ 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'
注意,六边形的边缘看起来有点参差不齐。您可以将--supersample 2添加到上一个命令中以解决此问题。给定的数字设置要使用的比例因子。值越大,结果越平滑,但内存使用率越高。这种效果的回报递减;通常值为2就足以获得一个好的结果,高于4并不会带来太大的显著改善。在
如您所见,此工具可以自动创建六边形贴纸,使其符合六边形标准。请随意另外调整您的徽标或输入图像的结果图像。在
此工具仅支持光栅图形。在
退出回购
要从存储库运行hexticker,请运行以下命令:
$ git clone https://github.com/fridex/hexsticker # or use ssh $cd hexsticker $ pip3 install -r requirements.txt --user $exportPYTHONPATH='.'$ ./hexsticker-cli --help
- 项目
标签: