Artistic QR Codes

Segno focuses on creating (Micro) QR codes and offers many output formats without additional dependencies on other libraries.

Advanced graphic operations require the qrcode-artistic plug-in, which in turn depends on the Pillow library.

The plugin can be used to create animated QR codes or static QR codes with a background image.

To install the plugin, use:

pip install qrcode-artistic

After that, every QR code created with segno.make() has two additional methods “to_pil” and “to_artistic”.

The former returns a Pillow Image instance, which can be used for further manipulations (e.g. rotating the QR code).

>>> import segno
>>> qr = segno.make('Yellow Submarine', error='h')
>>> img = qr.to_pil(scale=3).rotate(45, expand=True)
>>> img.save('yellow-submarine-rotated.png')
Colorful 3-H QR code encoding "Yellow Submarine" rotated by 45°

The “to_pil” method provides all options of Colorful QR Codes.

>>> import segno
>>> qr = segno.make('Yellow Submarine', error='h')
>>> img = qr.to_pil(scale=4, dark='darkred', data_dark='darkorange',
                    data_light='yellow')
>>> img.save('yellow-submarine.png')
Colorful 3-H QR code encoding "Yellow Submarine"

The “to_artistic” method can create animated or static QR codes.

>>> import segno
>>> qr = segno.make('The Beatles -- Albums', error='h')
>>> qr.to_artistic(background='src/albums.gif'), target='albums.gif' scale=8)
3-H QR code encoding "The Beatles -- Albums" (animated)

If the Pillow installation supports animated WebP images the plugin can save animated WebP images as well.

>>> import segno
>>> qr = segno.make('The Beatles -- Abbey Road', error='h')
>>> qr.to_artistic(background='src/abbey-road-walking.gif', target='abbey-road.webp' scale=4)
4-H QR code encoding "The Beatles -- Abbey Road" (animated)

The plugin also supports static backgrounds

>>> import segno
>>> qr = segno.make('The Beatles -- Let It Be', error='h')
>>> qr.to_artistic(background='src/letitbe.jpg', target='letitbe.jpg' scale=5)
3-H QR code encoding "The Beatles -- Let It Be" with a background image