Read saved QR images
Supply PNG, JPEG, WebP or GIF bytes to scan() and receive a Python dict containing decoded text, raw base64 bytes and QR score.
PyPI wheels
Python 3.8+
In-process
MIT
Decode QR images and raw RGBA frames inside scripts, notebooks and batch jobs using prebuilt PyO3 Rust wheels.
Supply PNG, JPEG, WebP or GIF bytes to scan() and receive a Python dict containing decoded text, raw base64 bytes and QR score.
Send raw RGBA pixel bytes with width and height to scan_frame() to skip image re-encoding inside computer-vision pipelines.
Read detections, occurrences, score (None when unmeasured) and trace.budget_exhausted, or pass formats to limit active readers.
Install prebuilt wheels from PyPI, pass image bytes to scan() and inspect the structured Python dict.
Set up a virtual environment running CPython 3.8 or later and install qrcode-barcode-scanner on PyPI. Prebuilt wheels ship for macOS ARM64/x64, GNU/Linux ARM64/x64, musl Linux x64 and Windows x64.
To try the SDK inside a browser notebook first, open the Google Colab notebook, launch it on Binder or browse the QR Code Scanner examples.
pip install qrcode-barcode-scanner
The PyPI package name uses hyphens (qrcode-barcode-scanner), while the Python import uses underscores (qrcode_barcode_scanner).
Passing --only-binary=:all: stops pip from falling back to a local Rust source build on unsupported platforms.
Import qrcode_barcode_scanner, supply image bytes (PNG, JPEG, WebP or GIF) to scan() and filter detections either by symbology or via the formats argument.
from __future__ import annotations
from pathlib import Path
import qrcode_barcode_scanner as qr
def read_qr_image(path: str) -> list[str]:
image_bytes = Path(path).read_bytes()
report = qr.scan(
image_bytes,
profile="full",
formats=["qr_code"],
max_dimension=4096,
max_pixels=16_000_000,
)
return [
d["content"]["text"]
for d in report["detections"]
if d["content"]["charset"] != "unknown"
]
Default work budgets are full (4000 ms), fast (800 ms) and frame (80 ms). Pass budget_ms=0 for reproducible unbounded scans.
Call qr.scan_frame(rgba, width, height, profile="frame") for raw RGBA pixel buffers; it neither opens a camera nor draws overlays.
For a QR image encoding https://qrcode-ai.com/, read_qr_image returns ["https://qrcode-ai.com/"]. Inspect report["score"] for QR scannability diagnostics (None means unmeasured, never zero).
An image containing no QR code returns an empty detections list (verify report["trace"]["budget_exhausted"] is False). Invalid image bytes or options raise ValueError ending with a QRS-xxx code.
Three functions, one engine. Use scan() for encoded image files, scan_frame() for raw RGBA buffers and capabilities() to inspect compiled readers. Everything executes natively in process with zero network calls.
Limits and exact payloads. Default input caps sit at 10,000 px per side and 64 million pixels; tighten max_dimension and max_pixels for untrusted uploads. Read base64 content["raw"] whenever content["charset"] is "unknown".
Licensing and notebooks. Current releases ship under the MIT licence (with Apache-2.0 notices in LICENSING.md). Refer to the Python package README and Python API docs for complete option tables.
Official package guides, ScanReport schema specification and licensing notices.
PyPI wheels, supported Python versions, RGBA frames, notebooks, errors and licensing.
It is QR Code AI’s open-source MIT-licensed PyO3 extension (qrcode-barcode-scanner on PyPI, imported as qrcode_barcode_scanner) that decodes QR codes, Micro QR, rMQR and 16 barcode formats directly in process and returns a structured Python dict.
CPython 3.8 or later is required. Prebuilt wheels ship for macOS ARM64/x64, GNU/Linux ARM64/x64, musl Linux x64 and Windows x64. Pass --only-binary=:all: to pip so it never tries to compile Rust from source.
Yes. Convert your OpenCV or Pillow frame into raw RGBA bytes and supply it with width and height to scan_frame(rgba, width, height, profile="frame"). scan_frame() decodes caller-supplied pixels without opening a camera or drawing an overlay.
Yes. Ready-to-run notebooks are hosted on Google Colab and Binder, linked in the installation section above as well as on the QR Code Scanner examples page.
When no code is detected, report["detections"] is an empty list (confirm report["trace"]["budget_exhausted"] is False). A score of None means unmeasured, never zero. Invalid inputs or unknown format names raise ValueError carrying a QRS-xxx code.
Yes. Pass formats=["qr_code"] to scan() or scan_frame(). Only the requested readers execute, and report["trace"]["formats"] reflects the active filter. Unknown format names raise ValueError ending with [QRS-006].
No. The compiled PyO3 extension decodes completely offline in process with zero network requests, no QR Code AI account, no API key and no creation credits.
Yes. Current releases ship under the MIT licence, permitting commercial and proprietary Python applications while preserving copyright and licence notices (check LICENSING.md). SDK usage is separate from QR Code AI’s paid creation plans and seven-day Premium trial.