Skip to main content

PIL/Pillow plugin for the Segno (Micro) QR Code generator

Project description

Segno PIL – Segno plugin for creating PIL/Pillow images from QR Codes

This Segno plugin converts a (Micro) QR Code to a PIL/Pillow Image.

This plugin is not required to write PNG, EPS or PDF files. Segno’s native implementations usually generate smaller files in less time. This plugin might be useful to modify the QR Codes (i.e. rotate or blur) or to save the QR codes in an image format which is not supported by Segno.

Usage:

>>> import segno
>>> qr = segno.make("One, two, three, four, one, two"
                    "Let me tell you how it will be"
                    "There's one for you, nineteen for me")
>>> img = qr.to_pil()  # Greyscale image, default scale
>>> img.save('example.png')
>>> qr.to_pil(scale=10).show()  # Show img with scale 10
>>> # Different scale
>>> img = qr.to_pil(scale=3)
>>> img.save('example-2.png')
>>> # Different scale and change module color
>>> img = qr.to_pil(scale=3, dark='darkblue')
>>> img.save('example-3.png')
>>> # Different scale and change dark and light module colors
>>> img = qr.to_pil(scale=3, dark='#36c', light=None)
>>> img.save('example-4.png')
>>> # Invert the example above
>>> img = qr.to_pil(scale=3, dark=None, light='#36c')
>>> img.save('example-5.png')
>>> # Save JPEG
>>> qr.to_pil(scale=3, dark='#36c', light='yellow').convert('RGB').save('example-6.jpg')
>>> rotated_img = img.rotate(3, expand=True)
>>> rotated_img.convert('RGB').save('example-7.jpg')
>>> # Multiple module colors
>>> qr = segno.make('Yellow Submarine', version=7, error='h')
>>> img = qr.to_pil(scale=4, dark='darkred', data_dark='darkorange',
                    data_light='yellow')
>>> img.save('yellow-submarine.png')

Changes

1.0.0 – 2020-08-07

  • Support for multiple module colors

  • Support for Segno’s API >= 1.0.0

  • API breaking changes:

    • Changed parameter “color” to “dark” and “background” to “light” to match Segno’s API

    • Removed “mode” parameter

0.1.6 – 2016-09-19

  • Fixed Python packaging

0.1.5 – 2016-08-24

  • Adapt Segno’s 0.1.6 API changes.

0.1.4 – 2016-08-16

  • Updated docs

0.1.3 – 2016-08-14

  • Initial release

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

segno-pil-1.0.0.tar.gz (4.9 kB view details)

Uploaded Source

Built Distribution

segno_pil-1.0.0-py2.py3-none-any.whl (4.9 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file segno-pil-1.0.0.tar.gz.

File metadata

  • Download URL: segno-pil-1.0.0.tar.gz
  • Upload date:
  • Size: 4.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.4.2 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.7.3

File hashes

Hashes for segno-pil-1.0.0.tar.gz
Algorithm Hash digest
SHA256 835573913cdfccc5377729c38e95bba803803844912e86b19b090e98926fadd5
MD5 222b373a28804e9449abc87ea85b404d
BLAKE2b-256 0e4cb3d489bcea9a892b1d6d92e7472e940bdf0b7a906946185000e67cc5e7a0

See more details on using hashes here.

File details

Details for the file segno_pil-1.0.0-py2.py3-none-any.whl.

File metadata

  • Download URL: segno_pil-1.0.0-py2.py3-none-any.whl
  • Upload date:
  • Size: 4.9 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.4.2 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.7.3

File hashes

Hashes for segno_pil-1.0.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 ba47b07ec2ad916dea4ccb227598c85e5b2bb3871b7e775e9b2473f7f2b7dace
MD5 a22c00d50e1b8cca7dc1bb4fb16bbc4b
BLAKE2b-256 4fa9b2ad24f27c6d2339e7918d4f86f4ffcbc7a248868bc4f18d5f15fda3245b

See more details on using hashes here.

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