Skip to main content

QR Code and Micro QR Code generator

Project description

Segno is a QR Code and Micro QR Code generator which has no further dependencies.

This package implements main parts of ISO/IEC 18004:2006(E) / ISO/IEC 18004:2015(E) and produces Micro QR Codes and QR Codes with nearly no effort.

Segno provides several serialization formats like SVG, EPS, PNG, PDF, or text output. Neither of these serializers require an external lib. Segno provides more serialization formats via a plugin architecture. It was tested against Jython, Python 2.6 - 3.4, and PyPy.

Installation

Use pip to install segno from PyPI:

$ pip install segno

Usage

Segno provides several, specific methods which serialize the QR Code (like svg, png), but it also provides a general save() method which could be used to save a QR Code in the desired format.

>>> import segno
>>> qr = segno.make('Up Jumped the Devil')  # Let Segno choose the minimal version
>>> qr.is_micro
False
>>> qr.version
2
>>> qr.error
'M'
>>> qr.save('up-jumped-the-devil.png')  # Save as PNG
>>> qr.save('up-jumped-the-devil-2.png', scale=10)  # Scaling factor 10
>>> qr.save('up-jumped-the-devil-3.png', background=None)  # Transparent background
>>> qr.save('up-jumped-the-devil.pdf', scale=10)  # Save as PDF
>>> # SVG drawing the dark modules in "dark blue"
>>> qr.save('up-jumped-the-devil.svg', scale=10, color='darkblue')

If the content to encode is small enough, a Micro QR Code is generated:

>>> import segno
>>> qr = segno.make('RAIN')
>>> qr.is_micro
True
>>> qr.version
'M2'

If this behaviour is not desired, the user may use the factory functions segno.make_qr() which generates always QR Codes (never Micro QR Codes) or segno.make_micro() which generates always Micro QR Codes (or raises an error if the content is too large for a Micro QR Code).

>>> import segno
>>> mqr = segno.make_micro('THE BEATLES')
>>> mqr.version
'M3'
>>> qr = segno.make_qr('THE BEATLES')  # Same content but enforce a QR Code
>>> qr.version
1
>>> # This won't work since the data does not fit into a Micro QR Code M1 - M4
>>> mqr = segno.make_micro('Nick Cave and the Bad Seeds')
Traceback (most recent call last):
    ...
DataOverflowError: Data too large. No Micro QR Code can handle the provided data

All factory functions use the same parameters to specify the desired error level, version, data mask etc., see Segno’s documentation for details.

Other QR Code generators

0.1.1 – 2016-08-14

  • Initial release

0.1.0 – 2016-08-14

  • Unreleased

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-0.1.1.tar.gz (43.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

segno-0.1.1-py2.py3-none-any.whl (46.1 kB view details)

Uploaded Python 2Python 3

File details

Details for the file segno-0.1.1.tar.gz.

File metadata

  • Download URL: segno-0.1.1.tar.gz
  • Upload date:
  • Size: 43.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for segno-0.1.1.tar.gz
Algorithm Hash digest
SHA256 beac9a4b3fb9f79322f7a5aa767e1cb6baf903db542f3ac444f98f3fa43830e6
MD5 d445ad0576b92983d57e0e09345cc477
BLAKE2b-256 deedc3883aeb3e44d739c2294599ba04d6fb12f980a7968b53976550dacab528

See more details on using hashes here.

File details

Details for the file segno-0.1.1-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for segno-0.1.1-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 09c968bfb77e57900429d48045197ac8bbe6d1fddd8dd1912d18cc15ffc883bb
MD5 baad606008ce6f83b0a801a39733e762
BLAKE2b-256 5b94011fbb50f8385463ece20e48d800a3cab53e36706081a3b2eae5e6aa4bb3

See more details on using hashes here.

Supported by

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