Read saved QR images
Pass PNG, JPEG, WebP or GIF bytes to scan() and receive a Python dict holding decoded text, raw base64 bytes and QR score.
PyPI wheels
Python 3.8+
In-process
MIT
Decode QR images and raw RGBA frames across scripts, notebooks and batch jobs with prebuilt PyO3 Rust wheels.
Pass PNG, JPEG, WebP or GIF bytes to scan() and receive a Python dict holding decoded text, raw base64 bytes and QR score.
Feed RGBA pixel bytes with width and height to scan_frame() without an image-encoding roundtrip in computer-vision pipelines.
Read detections, occurrences, score (None when unmeasured) and trace.budget_exhausted, or pass formats to restrict active readers.
Install prebuilt wheels from PyPI, call scan() on image bytes and inspect the returned Python dict.
Set up a virtual environment on CPython 3.8 or later and install qrcode-barcode-scanner on PyPI. Prebuilt binary wheels cover macOS ARM64/x64, GNU/Linux ARM64/x64, musl Linux x64 and Windows x64.
To try it in a browser notebook first, open the Google Colab interactive notebook, run it on Binder or browse QR Code Scanner Examples.
pip install qrcode-barcode-scanner
The PyPI package name uses hyphens (qrcode-barcode-scanner), whereas the Python import uses underscores (qrcode_barcode_scanner).
Adding --only-binary=:all: stops pip from falling back to a local Rust source build on unsupported platforms.
Import qrcode_barcode_scanner, pass image bytes (PNG, JPEG, WebP or GIF) to scan() and filter detections by symbology or through 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 profile 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 never opens a camera or draws overlays.
For a QR image encoding https://qrcode-ai.com/, read_qr_image returns ["https://qrcode-ai.com/"]. Check report["score"] for QR scannability diagnostics (None means unmeasured, never zero).
An image containing no QR code returns an empty detections list (confirm report["trace"]["budget_exhausted"] is False). Invalid bytes or options raise ValueError ending with a QRS-xxx code.
Three functions, one engine. Call scan() for encoded image files, scan_frame() for raw RGBA bytes and capabilities() to inspect compiled readers. Every call runs natively in process with no network access.
Caps and exact payloads. Default input limits are 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). Check the Python package README and Python API documentation for complete option tables.
Official package guides, ScanReport specification and licensing references.
PyPI wheels, Python support, 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 in process and returns a structured Python dict.
CPython 3.8 or newer is required. Prebuilt wheels ship for macOS ARM64/x64, GNU/Linux ARM64/x64, musl Linux x64 and Windows x64. Add --only-binary=:all: to pip to prevent a fallback Rust source build.
Yes. Convert your OpenCV or Pillow frame into raw RGBA bytes and pass it with width and height to scan_frame(rgba, width, height, profile="frame"). scan_frame() decodes caller-provided pixels without opening a camera or rendering overlays.
Yes. Ready-to-run official notebooks are available in Google Colab and Binder, linked in the install section above and on QR Code Scanner Examples.
When no code is detected, report["detections"] is an empty list (verify report["trace"]["budget_exhausted"] is False). A None score means unmeasured, never zero. Invalid inputs or unknown format keys 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"] records the active filter. Unknown format names raise ValueError ending in [QRS-006].
No. The compiled PyO3 extension runs 100% locally 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 for commercial and proprietary Python software provided copyright and licence notices are kept intact (see LICENSING.md). SDK use is separate from QR Code AI’s paid creation plans and seven-day Premium trial.