QR Code & Barcode Scanner for Rust
Ask AI
Choose an AI assistant to explain this destination using its public sources. Gemini opens gemini.google.com. Gemini, Copilot, DeepSeek, Meta AI and Qwen require pasting the prompt below; the other links include it in their URL. Sign-in or a manual paste may still be required. Check the answer against the documentation.
Use the code block's copy control, or select its complete text, then paste it into your assistant.
Help me understand QR Code & Barcode Scanner for Rust (crates/qrcode-ai-scanner/README.md) for QR Code & Barcode Scanner, the open-source scanner. Source documentation; publication is not implied. Provided README context (verify against the sources): Use the Rust library when your program needs to scan image bytes or RGBA frames in process and inspect the resulting detections. The report separates decoded content from its physical occurrences and keeps an unmeasured QR quality score distinct from a zero score. Start with the image example below, then choose profiles and input limits for your workload. Read the public documentation below. Explain what this destination does, its documented installation or access steps, a minimal example if supported, prerequisites, limitations and license. Distinguish published packages from working source and preparation. Cite your sources; if a page is unavailable or a fact cannot be checked, say so. Do not invent installation commands, benchmark results or comparisons. Answer in my language. Public sources: https://github.com/qrcode-ai-com/qrcode-barcode-scanner-rust/blob/main/crates/qrcode-ai-scanner/README.md https://qrcode-ai.com/en-US/qr-code-scanner https://qrcode-ai.com/en-US/barcode-scanner https://qrcode-ai.com/en-US/qr-code-scanner/sdk/rust https://qrcode-ai.com/en-US/barcode-scanner/sdk/rust https://qrcode-ai.com/en-US/qr-code-generator https://qrcode-ai.com/en-US/barcode-generator
Use the Rust library when your program needs to scan image bytes or RGBA frames in process and inspect the resulting detections. The report separates decoded content from its physical occurrences and keeps an unmeasured QR quality score distinct from a zero score. Start with the image example below, then choose profiles and input limits for your workload.
The QR code scanner and barcode scanner are QR Code AI’s browser scanning entry points. For the corresponding development route, the QR code scanner Rust guide and barcode scanner Rust guide connect this documentation to the two product journeys. If a product page is unavailable, the instructions and references in this README remain the starting point for this source directory.
To prepare a fixture with a known payload for a Rust application, use the QR code generator or the barcode generator. Keep the original payload with the exported image so that you can compare the scan result with the value you intended to encode.
Decode QR codes, linear barcodes and other 2D formats, including Data Matrix, from local images or raw RGBA frames. Read decoded content and measured symbol positions from one structured report. QR scannability diagnostics add stress-test results and suggestions for improving artistic or photo-captured codes.
qrcode-barcode-scanner is the Rust core of QR Code AI.
It runs locally, with no network requests.
API · Report contract · Scoring
For a one-off image check, the browser image example uses the same engine.
How it works
The picture shows the three steps of the crate. They are the next three sections: add the crate to a project, pass the bytes of an image to the engine inside your program, then read the report it returns.
Install
Use Rust 1.88 or later. Create a binary project and add the exact scanner version so that the dependency and the documentation can be reviewed together:
For working source, verify that the selected version exists on crates.io before installation. Source revisions and registry releases have separate availability and licenses.
Scan an image
Save the following complete program as src/main.rs, then run
cargo run --release from the project directory. The sample contains QR
https://qrc-ai.com/76xMa and Code 128 STOCK-4827; compare the decoded
values, rather than assuming a detection's array position.
use ;
Encoded input accepts PNG, JPEG, WebP and GIF. Use ImageInput::rgba8 for raw
frames without an image-format roundtrip. Compiled format support depends on the
selected engine features; the capabilities API lists the readers included in the
build, not a guarantee that a particular image will decode.
Read the report
The picture is a recorded scan of one image that holds a QR code and a Code 128 barcode. Both come back in the same report, each with its format and the place where the engine measured it.
| Field | Meaning |
|---|---|
detections |
Distinct decoded contents, with their symbology and payload classification. |
detections[*].occurrences |
Measured physical copies of each content. Two copies can belong to one detection. |
score |
QR scannability assessment when available. None means no score, never zero. |
hints |
Suggestions derived from the measurements the engine actually made. |
trace.budget_exhausted |
Whether the deadline prevented planned scan work. |
Use the geometry that was measured: a linear barcode can have endpoints instead of four corners. Only the QR family carries QR metadata and correction-margin diagnostics. These software measurements do not certify a code with a hardware barcode verifier.
For the QR family, content.raw holds the original payload bytes. For other
symbologies it holds the decoding engine's reading, encoded as ISO/IEC 8859-1
when every character fits, otherwise UTF-8. content.charset describes how
content.text reads those bytes; unknown is the only lossy value, so use
raw in that case. Content identity includes the symbology, raw bytes, FNC1
position and compatible ECI declarations, never display text alone.
When no code is detected, the scan returns Ok with an empty detections list.
Errors cover invalid input
(QRS-001..004), cancellation (QRS-005) and invalid options (QRS-006);
branch on err.code(). A zero Limits cap or ScanConfig side, a palette above
ScanConfig::MAX_ALPHA_PALETTE, or a budget above
ScanConfig::MAX_BUDGET_MS is refused before the image is read.
The full, fast and frame profiles select the scan workload and default
budget. A report is final when report.trace.budget_exhausted == Some(false).
Set the configuration's budget_ms to None for an unbounded scan; a time-bounded
scan can stop before planned work finishes, which the trace records.
ScanConfig.formats restricts a scan to the symbologies it lists: no reader of
another symbology runs, and the report repeats them in trace.formats. Empty,
the default, reads every symbology.
The multi-engine ladder uses rxing and rqrr. QR quality diagnostics include survival-ramp stress tests and the synthetic unused-error-correction margin measured from the verified stream. See the scoring contract for the measurement limits and which results can be absent.
What it reads
With its default features, the crate reads the formats below. Codes of different formats in the same image come back in one report.
| Family | Formats |
|---|---|
| QR | QR Code, Micro QR, rectangular Micro QR (rMQR) |
| Matrix and stacked | Data Matrix, Aztec, PDF417, MaxiCode |
| Retail | EAN-13, EAN-8, UPC-A, UPC-E |
| Other linear | Code 128, Code 39, Code 93, Codabar, ITF, GS1 DataBar, GS1 DataBar Expanded, Telepen |
The engine's supported formats section states the known limits.
The same engine in other runtimes
| Runtime | Package | How it scans |
|---|---|---|
| Rust | qrcode-barcode-scanner on crates.io |
In process |
| Node.js | @qrcode-ai-com/qrcode-barcode-scanner on npm |
In process, native |
| Browser | @qrcode-ai-com/qrcode-barcode-scanner-wasm on npm |
In the page, WebAssembly |
| Python | qrcode-barcode-scanner on PyPI |
In process |
| Go | qrcode-barcode-scanner-go |
Through the installed qrscan |
| PHP | qrcode-barcode-scanner-php |
Through the installed qrscan |
| Command line | qrscan |
One command, one JSON report |
The Rust, Node.js, browser and Python packages hold the engine. The Go and PHP packages hold no decoder:
each one starts qrscan and hands you its report.
Language and platform names and logos belong to their owners. They identify a runtime or a destination and imply no endorsement.
Documentation and licensing
Architecture · Error codes · Security · Report a bug
Releases up to 0.10.1 were published as qrcode-ai-scanner.
Source license: MIT. Published archives retain their own packaged license. Read the current licensing guide and the license packaged with the exact version you install. © SuperNovae Studio.
Maintained by Thibaut Mélen & Nicolas Cella for QR Code AI, a product of SuperNovae Studio. The license of each component is stated in its own license files.
Source license
Project-authored scanner code and documentation in this checkout are available under the MIT License. You may use, modify and redistribute this source in open-source or proprietary applications, including commercial products, while preserving the copyright and permission notice. Thibaut Mélen & Nicolas Cella develop QR Code AI at SuperNovae Studio.
Retained third-party code, dependencies, artwork and test data keep their own licenses and notices. The licensing guide explains these component boundaries; the project license does not assign a license to an unrelated platform or service.
Published archives retain the license shipped with their version. A pinned engine, adapter or bundle may therefore have different terms from this working source. Read its packaged license and the license history before reuse. The source change does not replace an archive or publish a new version.