Skip to main content

Convert any image to image that conforms with hexagon stickers standard.

Project description

Produce hexagon stickers automatically from an image in compliance with the Stickers Standard.

Installation

$ pip install hexsticker

After the installation step listed above, you will be able to use the hexsticker command:

$ hexsticker --help

Requirements

  • Python 3.6+

Examples

Let’s create a hexagon sticker for the Selinon project.

Here is the input image:

Selinon input logo

Let’s create a hexagon sticker:

$ hexsticker selinon.png -o selinon-sticker-1.png
INFO:hexsticker.create:Writing output to 'selinon-sticker-1.png'

The resulting image is:

Selinon hexagon sticker sticker 1

As can be seen above, there are some parts cut off - let’s add some padding to the image:

$ hexsticker input/selinon.png -o output/selinon-sticker-2.png --padding-size 25
INFO:hexsticker.create:Writing output to 'selinon-sticker-2.png'
Selinon hexagon sticker sticker 2

The padded part is white by default - that’s why there are missing spikes of hexagon. Let’s set color of padded area to the same color as background color of the original image:

$ 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'
Selinon hexagon sticker sticker 3

Nice! What we could do next? Let’s try to add a hexagon border:

$ 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'
Selinon hexagon sticker sticker 4

Ehm, the default black one does not look that good in this case. Let’s try some color that fits color scheme:

$ 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'
Selinon hexagon sticker sticker 5

Note that the edges of the hexagon look a little jagged. You can add --supersample 2 to the previous command to remedy this. The number given sets the scale factor to use. Greater values result in a smoother result, at the expense of higher memory usage. This effect has diminishing returns; usually a value of 2 is enough for a nice result and going higher than 4 does not make much noticeable improvement.

As you can see, this tool can automate creation of hexagon stickers so they respect the hexagon standard. Feel free to additionally adjust the resulting image of your logo or the input image.

This tool supports only raster graphics.

Running from repo

To run hexsticker from repository run the following commands:

$ git clone https://github.com/fridex/hexsticker  # or use ssh
$ cd hexsticker
$ pip3 install -r requirements.txt --user
$ export PYTHONPATH='.'
$ ./hexsticker-cli --help

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

hexsticker-1.2.0.tar.gz (6.6 kB view hashes)

Uploaded Source

Built Distribution

hexsticker-1.2.0-py3-none-any.whl (14.2 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page