Segno

1.6.6 · active · verified Sat Apr 11

Segno is a pure Python library for generating QR Codes and Micro QR Codes according to ISO/IEC 18004:2015(E). It provides various serialization formats like Scalable Vector Graphics (SVG), Portable Network Graphics (PNG), Encapsulated PostScript (EPS), Portable Document Format (PDF), and more, without external dependencies for these core functionalities. Currently at version 1.6.6, Segno maintains an active release cadence with several updates per year.

Warnings

Install

Imports

Quickstart

This quickstart generates two QR codes: a basic one and a colorful one, saving them as PNG images. Segno automatically determines the minimal version and optimal error correction level by default.

import segno

# Create a QR code for a URL
qrcode = segno.make('https://example.com/your-data')

# Save the QR code as a PNG file with a scale of 5
qrcode.save('my_qrcode.png', scale=5)

# Or save as SVG
# qrcode.save('my_qrcode.svg', scale=5)

# Create a colorful QR code
colorful_qrcode = segno.make('https://example.com/colorful', dark='darkblue', light='lightblue')
colorful_qrcode.save('my_colorful_qrcode.png', scale=5)

print('QR codes generated successfully: my_qrcode.png and my_colorful_qrcode.png')

view raw JSON →