qrcode

Pure-Python QR code image generator with pluggable PIL, SVG, and terminal renderers

Library
PyPI
v8.2
4,929stars
BSD 3-Clause License

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum.How we score it →
49/100Fair
Development Activity8
Maintenance0
Community88
Maturity60
Momentum40

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation.How we score it →
77/100Good
Architecture78
Code Quality75
Innovation68
Learning Curve85

qrcode is a Python library for generating QR code images per the ISO/IEC 18004 spec, with a pure-Python encoder and a set of pluggable image factories — Pillow bitmap output, SVG (including SVG path/fragment/rectangle variants), styled PIL images with rounded modules and embedded logos, and a plain-text/terminal renderer for quick command-line previews. It ships both as an importable module and as a qr console script for generating codes directly from the shell.

What You Get

  • A pure-Python QR code encoder implementing ISO/IEC 18004 with configurable error-correction levels
  • Multiple pluggable image factories: PilImage, several SVG variants (SvgImage, SvgFragmentImage, SvgPathImage), and PyPNGImage
  • StyledPilImage support for rounded/circular module drawers and embedding a logo image inside the generated code
  • A plain-text/terminal print mode (qr.print_ascii()) for quickly previewing a code without saving a file
  • A qr command-line console script for generating QR codes directly from shell pipelines

Common Use Cases

  • Generating QR codes for URLs, contact cards (vCard), or Wi-Fi network credentials embedded in web or mobile app pages
  • Producing print-ready vector QR codes (SVG) for packaging, posters, or marketing collateral
  • Branding QR codes with a company logo or custom module styling via StyledPilImage for marketing materials
  • Piping quick QR codes from shell scripts or CI pipelines using the bundled qr console command

Under The Hood

Architecturebase.py/util.py implement the QR encoding algorithm (data segment encoding, Reed-Solomon error correction, mask pattern scoring) producing an abstract module matrix; main.py’s QRCode class drives generation and delegates rendering to an injectable image_factory, with concrete factories in image/ (pil.py, svg.py, styledpil.py, pure.py) implementing a common interface so new output formats can be added without touching the encoder. Tech Stack — Pure Python core with zero hard runtime dependencies; Pillow is an optional dependency pulled in only when the PIL image factory is used, and the build uses Poetry (poetry-core) as its build backend. Code Quality — An 18-file tests/ package exercises the encoder, each image factory, and the console script; the project has a PACKAGING.rst/TESTING.rst and a signed release process (signing-key.asc), signals of a maintained release discipline even though day-to-day commit activity is currently low. API Design — The default path (qrcode.make(data)) requires a single function call for a basic PNG, while advanced use (custom error correction, styled modules, SVG variants) is opt-in through constructor keyword arguments and the swappable image_factory parameter — a clean minimal-to-advanced API progression.

Join founders buildingwith open source

Opinionated takes, migration guides, cost-saving tips, and insights from the open source ecosystem.

Subscribe on Substack
Join 750+ subscribers

Search