Python QR Code Scanner SDK

Add offline QR code scanning straight into your Python scripts, Jupyter notebooks and backend jobs. Install prebuilt MIT-licensed PyO3 wheels from PyPI, feed encoded image bytes or RGBA frames in process and read the structured ScanReport dict.

Python
import qrcode_barcode_scanner as qr

report = qr.scan(image_bytes, profile="frame")
code = next((d for d in report["detections"]
             if d["symbology"] == "qr_code"), None)

if code is not None:
    print(code["content"]["text"])

Inspect the decoded resulthttps://qrcode-ai.com/

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.

pip install qrcode-barcode-scanner

Need to scan a code right away? Open online reader

Python QR Code Scanner SDK at a glance

  • Prebuilt PyO3 wheels, no Rust needed

    PyPI wheels

  • Scripts, notebooks & backend services

    Python 3.8+

  • Zero network calls or external CLI

    In-process

  • Open-source licence

    MIT

Add native QR scanning to Python

Decode QR images and raw RGBA frames across scripts, notebooks and batch jobs with prebuilt PyO3 Rust wheels.

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.

Scan raw RGBA frames

Feed RGBA pixel bytes with width and height to scan_frame() without an image-encoding roundtrip in computer-vision pipelines.

Dict report & formats filter

Read detections, occurrences, score (None when unmeasured) and trace.budget_exhausted, or pass formats to restrict active readers.

Add QR image reading in Python

Install prebuilt wheels from PyPI, call scan() on image bytes and inspect the returned Python dict.

Install the Python package from PyPI

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.

Decode a QR image in Python

Import qrcode_barcode_scanner, pass image bytes (PNG, JPEG, WebP or GIF) to scan() and filter detections by symbology or through the formats parameter.

Python
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.

Inspect the decoded result

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.

PyO3 extension, resource caps and payload fidelity

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.

Python QR Code Scanner documentation and licence

Official package guides, ScanReport specification and licensing references.

Python QR Code Scanner SDK questions

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.