Skip to main content

Pure Python QR Code generator with no dependencies.

This package implements ISO/IEC 18004:2015(E) “QR Code bar code symbology specification” and produces QR Codes and Micro QR Codes with nearly no effort. It supports the Structured Append mode which splits a message across several QR codes.

Segno (Italian for “sign” / “symbol”) provides several serialization formats like Scalable Vector Graphics (SVG), Encapsulated PostScript (EPS), Portable Network Graphics (PNG), Portable Document Format (PDF), Netpbm (PAM, PBM, PPM), LaTeX (PGF/TikZ), X PixMap (XBM), and X Bitmap (XPM) etc. None of these serializers require an external lib. Further, it provides several high level functions to create QR Codes which encode contact data (vCard, MeCard), EPC QR Codes, or WIFI QR Codes.

The project provides more than 1500 test cases (coverage >= 98%) to verify a standard conform QR Code and Micro QR Code generation acc. to ISO/IEC 18004:2015(E).

Unique features

import segno
qrcode = segno.make('Yellow Submarine')
qrcode.save('yellow-submarine.png')

Installation

Use pip to install segno from PyPI:

$ pip install segno

conda-forge

The library is also available at conda-forge (conda-forge project page):

$ conda install -c conda-forge segno

Debian

$ apt-get install python3-segno

Arch Linux

$ pacman -S python-segno

Usage

Command line

The command line script prints a QR code to the terminal:

$ segno "Comfortably Numb"

To serialize a QR code, use the “output” argument:

$ segno -o=raincoat.svg "Famous Blue Raincoat"
$ segno --scale 10 --dark darkblue --border 0 --output=fire.svg "Who by Fire"
$ segno --scale 10 --light transparent --output=miracle.png "Waiting for the Miracle"

Library

>>> import segno
>>> # Let Segno choose the minimal version and an optimal (maximal) error
>>> # level without changing the minimal version
>>> qrcode = segno.make('Up Jumped the Devil')
>>> qrcode.designator  # Returns the QR code version and the error correction level
'2-Q'
>>> qrcode.save('up-jumped-the-devil.png')  # Save as PNG
>>> qrcode.save('up-jumped-the-devil-2.png', scale=10)  # Scaling factor 10
>>> qrcode.save('up-jumped-the-devil-3.png', light=None)  # Transparent light modules
>>> qrcode.save('up-jumped-the-devil.pdf', scale=10)  # Save as PDF
>>> # SVG drawing the dark modules in "dark blue"
>>> qrcode.save('up-jumped-the-devil.svg', scale=10, dark='darkblue')

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

>>> import segno
>>> qrcode = segno.make('RAIN')
>>> qrcode.is_micro
True
>>> qrcode.designator
'M2-M'

If this behaviour is not desired, the user may set micro to False

>>> import segno
>>> qrcode = segno.make('RAIN', micro=False)
>>> qrcode.is_micro
False
>>> qrcode.designator
'1-H'

Or use the factory functions segno.make_qr() which generates always QR codes (never Micro QR codes) or segno.make_micro() which returns always Micro QR codes (or raises an error if the content is too large for a Micro QR code).

>>> import segno
>>> qrcode_micro = segno.make_micro('THE BEATLES')
>>> qrcode_micro.designator
'M3-M'
>>> qrcode = segno.make_qr('THE BEATLES')  # Same content but enforce a QR Code
>>> qrcode.designator
'1-Q'
>>> # This won't work since the data does not fit into a Micro QR Code M1 - M4
>>> micro_qrcode = 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.

Documentation

Read the online documentation at <https://segno.readthedocs.io/>

Trademark

“QR Code” and “Micro QR Code” are registered trademarks of DENSO WAVE INCORPORATED.

Metadata

Release files for segno 1.6.6

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for segno 1.6.6
File Size Uploaded
segno-1.6.6.tar.gz 1.6 MB Details

Built distribution (wheel)

Table of built distributions (wheels) for segno 1.6.6
File Interpreter ABI Platform
segno-1.6.6-py3-none-any.whl Python 3 none any Details

Total release size: 1.7 MB

Release files / segno-1.6.6.tar.gz

Download URL segno-1.6.6.tar.gz
Size 1.6 MB
Tags Source
SHA-256 checksum
How to use checksums
e60933afc4b52137d323a4434c8340e0ce1e58cec71439e46680d4db188f11b3
BLAKE2b-256 checksum
How to use checksums
1c2eb396f750c53f570055bf5a9fc1ace09bed2dff013c73b7afec5702a581ba
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.2

Release files / segno-1.6.6-py3-none-any.whl

Download URL segno-1.6.6-py3-none-any.whl
Size 76.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
28c7d081ed0cf935e0411293a465efd4d500704072cdb039778a2ab8736190c7
BLAKE2b-256 checksum
How to use checksums
d60212c73fd423eb9577b97fc1924966b929eff7074ae6b2e15dd3d30cb9e4ae
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.2

Release history Release notifications | RSS feed

This release

1.6.6 This release

2 release files

1.6.5

2 release files

1.6.4

2 release files

1.6.1

2 release files

1.6.0

2 release files

1.5.3

2 release files

1.5.2

2 release files

1.4.1

2 release files

1.4.0

2 release files

1.3.3

2 release files

1.3.1

2 release files

1.3.0

2 release files

1.2.1

2 release files

1.2.0

2 release files

1.1.0

2 release files

1.0.2

2 release files

1.0.1

2 release files

1.0.0

2 release files

0.4.0

2 release files

0.3.9

2 release files

0.3.8

2 release files

0.3.7

2 release files

0.3.6

2 release files

0.3.5

2 release files

0.3.4

2 release files

0.3.3

2 release files

0.3.2

2 release files

0.3.0

2 release files

0.2.9

2 release files

0.2.8

2 release files

0.2.7

2 release files

0.2.6

2 release files

0.2.5

2 release files

0.2.4

2 release files

0.2.3

2 release files

0.2.2

2 release files

0.2.1

2 release files

0.2.0

2 release files

0.1.9

2 release files

0.1.8

2 release files

0.1.7

2 release files

0.1.6

2 release files

0.1.5

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page