Read saved QR images
Pass 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 in scripts, notebooks and batch jobs with pre-built PyO3 Rust wheels.
Pass PNG, JPEG, WebP or GIF bytes to scan() and receive a Python dict containing decoded text, raw base64 bytes and QR score.
Pass RGBA pixel bytes with width and height to scan_frame() without an image-format round-trip in computer-vision pipelines.
Inspect detections, occurrences, score (None when unmeasured) and trace.budget_exhausted, or pass formats to restrict readers.
Install pre-built wheels from PyPI, call scan() on image bytes and inspect the returned dict.
Create a virtual environment with CPython 3.8 or later and install qrcode-barcode-scanner on PyPI. Pre-built wheels cover macOS ARM64/x64, GNU/Linux ARM64/x64, musl Linux x64 and Windows x64.
To test in 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 distribution uses hyphens (qrcode-barcode-scanner); the Python import uses underscores (qrcode_barcode_scanner).
Using --only-binary=:all: prevents pip from attempting a local Rust source compilation on unsupported platforms.
Import qrcode_barcode_scanner, pass image bytes (PNG, JPEG, WebP or GIF) to scan() and filter detections by symbology or with the formats parameter.
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 budgets are full (4000 ms), fast (800 ms) and frame (80 ms). Pass budget_ms=0 for reproducible unbounded scans.
Use qr.scan_frame(rgba, width, height, profile="frame") for raw RGBA pixel buffers; it does not acquire a camera or draw overlays.
For a QR image encoding https://qrcode-ai.com/, read_qr_image returns ["https://qrcode-ai.com/"]. Read report["score"] for QR scannability diagnostics (None means unmeasured, never zero).
An image with no QR code returns an empty detections list (check report["trace"]["budget_exhausted"] is False). Invalid image bytes or options raise ValueError ending with a QRS-xxx code.
Three functions, one engine. Call scan() for encoded images, scan_frame() for raw RGBA bytes and capabilities() to inspect compiled readers. All run natively in process with no network calls.
Limits and exact payloads. Default input caps are 10,000 px per side and 64 million pixels; lower max_dimension and max_pixels for untrusted uploads. Use base64 content["raw"] whenever content["charset"] is "unknown".
Licensing and notebooks. Current releases are MIT-licensed (with Apache-2.0 notices in LICENSING.md). See the Python package README and Python API docs for full option tables.
Official package documentation, ScanReport specification and licensing references.
PyPI wheels, Python versions, RGBA frames, notebooks, errors and licensing.
It is QR Code AI’s open-source MIT PyO3 extension (qrcode-barcode-scanner on PyPI, imported as qrcode_barcode_scanner) that decodes QR codes, Micro QR, rMQR and 16 barcode formats in process and returns a structured Python dict.
CPython 3.8 or later is required. Pre-built wheels cover macOS ARM64/x64, GNU/Linux ARM64/x64, musl Linux x64 and Windows x64. Pass --only-binary=:all: to pip to avoid falling back to a Rust source build.
Yes. Convert your OpenCV or Pillow frame to raw RGBA bytes and pass it with width and height to scan_frame(rgba, width, height, profile="frame"). scan_frame() decodes caller-supplied pixels without opening a camera or rendering an overlay.
Yes. Official notebooks are ready in Google Colab and Binder, linked in the install section above and on the QR Code Scanner examples page.
When no code is found, report["detections"] is an empty list (confirm report["trace"]["budget_exhausted"] is False). A None score 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 run, and report["trace"]["formats"] echoes the filter. Unknown format names raise ValueError ending in [QRS-006].
No. The compiled PyO3 extension decodes locally in process with zero network requests, requiring no internet access, QR Code AI account, API key or creation credits.
Yes. Current releases are published under the MIT licence, permitting commercial and proprietary use while retaining copyright and licence notices (see LICENSING.md). SDK use is separate from QR Code AI’s paid creation plans and seven-day Premium trial.