qrcode-generator

Pure-Rust QR Code, Micro QR, and rMQR generation with PNG and SVG rendering.

Library
Cargo
v6.0.0
72stars
MIT License

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum.How we score it →
53/100Fair
Development Activity68
Maintenance36
Community36
Maturity60
Momentum12

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation.How we score it →
84/100Excellent
Architecture86
Code Quality85
Innovation82
Learning Curve84

qrcode-generator is a pure-Rust library that produces ISO/IEC 18004 QR Code and Micro QR Code symbols and ISO/IEC 23941 rMQR symbols, then renders them as grayscale module matrices, PNG images, or SVG output. Its text encoders automatically pick the shortest Numeric, Alphanumeric, Byte, and optional Kanji segmentation for each candidate version, and the Model 2 and rMQR encoders optimize ECI transitions for compact symbols.

The API is small: build an Encoder with a chosen error-correction level, encode text or binary data into a symbol, then read the raw matrix or hand it to a Renderer to save PNG/SVG files. Optional features add image output, async file writing via Tokio, Kanji encoding, and URL handling, so you only compile what you need.

What You Get

  • QR Code (ISO/IEC 18004), Micro QR, and rMQR (ISO/IEC 23941) symbol generation
  • Automatic Numeric/Alphanumeric/Byte/Kanji segmentation for the shortest encoding
  • Rendering to a raw boolean matrix, PNG images, or SVG output
  • Selectable error-correction levels per symbol
  • Feature flags for image output, Tokio async writing, Kanji, and URL handling

Common Use Cases

  • Generating scannable QR PNG or SVG images from URLs or text
  • Producing compact rMQR or Micro QR codes for space-constrained labels
  • Reading the raw module matrix to render QR codes in a custom UI or format

Under The Hood

Architecture - The crate splits encoding from rendering: src/encode holds the per-model encoders (QR Model 2, Micro QR, rMQR) that select segmentation and error correction, src/render.rs turns a symbol into matrices/PNG/SVG, and src/lib.rs exposes the Encoder and Renderer types with src/url.rs and src/error.rs supporting features and errors. Tech Stack - Rust edition 2024 (MSRV 1.89), pure-Rust generation with optional dependencies gated by features: image for PNG, tokio for async file writes, encoding_rs for Kanji, url for URL payloads, atomic-write-file for safe file output, and html-escape for SVG. Code Quality - The repo includes a tests/ suite that cross-checks output against independent decoders (quircs, rxing), benches/, and examples/, giving strong confidence the generated symbols are standards-compliant and scannable. API Design - The public surface is ergonomic and composable: construct an Encoder with an ErrorCorrection level, call encode_text or encode_data, then either read to_matrix or pass the symbol to a Renderer with save_png/save_svg, minimizing boilerplate.

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