Scan a saved label
Pass encoded bytes from an upload, screenshot or label photo to scan_image. The Code 128 example outputs STOCK-4827 alongside other supported formats.
1D + 2D
Image + frame
10
MIT
One open-source MIT Rust engine decodes 16 linear and 2D barcode symbologies (plus QR codes) from saved images or camera frames, returning exact identifier strings alongside each detected format.
Barcode Scanner and QR Code Scanner share the identical 10 language packages. Just scanning one label now? Open the online Barcode Scanner.
Accepts encoded image files and raw RGBA camera frames, leaving your app in full control of symbology filtering and downstream actions.
Pass encoded bytes from an upload, screenshot or label photo to scan_image. The Code 128 example outputs STOCK-4827 alongside other supported formats.
Pass RGBA pixels to scan_frame or wire up the browser /camera controller. Your app owns camera permissions and lifecycle.
Read symbology (such as code128) and content.text strictly as strings so leading zeros survive downstream validation or lookup.
Choose from 10 published SDK packages sharing one decoding engine and JSON report format, including browser JS/TS and Android Kotlin/Java.
Packages and registries verified on 27 November 2026. Browse full cross-language guides in the GitBook SDK documentation and the open-source scanner repository, or try the browser build on GitHub Pages. Go and PHP wrap the local qrscan executable; the Barcode Scanner CLI has its own guide.
Plan label capture and output handling. Expand the snippet below for exact code and install commands.
Your app owns the file picker or camera stream, loading state and output controls. Initialise WASM once and run synchronous scans inside a Web Worker; for live cameras, capture RGBA frames and provide explicit stop controls.
Store every decoded identifier strictly as a string so leading zeros never drop. Clear stale output after empty scans and handle decode exceptions separately.
Follow the JavaScript barcode scanner guide for full browser integration steps.
Need a quick test label? Create a barcode with Barcode Generator using Code 128 and STOCK-4827, export it as PNG and check the decoded text matches.
Pick your preferred package manager. Each command installs the identical MIT-licensed WebAssembly package from npm.
Before adding the library to a project, review its open-source licensing guide. To test it online first, launch the Vite starter on StackBlitz, which installs this package and scans locally in your browser.
npm install @qrcode-ai-com/qrcode-barcode-scanner-wasm
Initialise the WASM module once, then pass a browser File to readBarcodeImage. It keeps Code 128, Code 39, EAN-13, EAN-8, UPC-A, UPC-E, ITF and Data Matrix detections, returning exact symbology and text pairs or an empty array if none match. To allow more formats, append their identifiers to barcodeFormats: pdf417, aztec, maxi_code, code93, codabar, data_bar, data_bar_expanded or telepen. Check the ScanReport specification for all identifiers.
import init, { scan_image } from "@qrcode-ai-com/qrcode-barcode-scanner-wasm";
await init();
const barcodeFormats = new Set([
"code128", "code39", "ean13", "ean8",
"upc_a", "upc_e", "itf", "data_matrix"
]);
export async function readBarcodeImage(file) {
const bytes = new Uint8Array(await file.arrayBuffer());
const report = scan_image(bytes, "frame", undefined, undefined, 1000);
return report.detections
.filter((detection) => barcodeFormats.has(detection.symbology))
.map((detection) => ({
symbology: detection.symbology,
text: detection.content.text
}));
}
The second parameter picks the profile: "frame" decodes only, while "full" and "fast" also score the first code in the report.
Both undefined arguments keep the engine’s default size limits used in the browser demo: 10,000 px per side and 64,000,000 pixels, comfortably covering a typical mobile phone photo up to 48 megapixels. Larger images fail with input error QRS-002 or QRS-003 without resizing. On public-facing servers, set tighter bounds such as the documented 4,096 px and 16,000,000 pixels.
The 1,000 ms work budget is a cap rather than a latency guarantee because image decoding runs before that timer starts. Keep synchronous WASM scans inside a Web Worker to keep the UI smooth.
For a Code 128 label storing STOCK-4827, the function returns:
[
{ "symbology": "code128", "text": "STOCK-4827" }
]
Direct API, report and licence references, or browse every runtime in the GitBook SDK documentation.
A stock label and a retail identifier show how decoded strings map cleanly into application data.

The Code 128 label returns STOCK-4827 with symbology code128. Preserve both fields so your app can verify the symbology and query your inventory or asset system.

EAN-13 returns 1234567890128 while UPC-A keeps leading zeros such as 012345678905. Keep every value as text before querying your product catalogue.
Install your runtime’s package, pass a crisp label image or frame and keep every decoded character intact.
Add the package matching your web, server or mobile stack. In browsers, initialise WASM once client-side when scanning begins.
Call scan_image on encoded bytes or scan_frame on RGBA pixels with the full barcode and quiet zone clearly framed.
Preserve symbology and exact digits (including leading zeros), clear stale state on empty runs and handle errors separately.
Drive business logic from the detected symbology and string value; parsed identifiers and quality diagnostics cover separate scopes.
See the ScanReport specification for every field and null rule. All 10 language bindings return the identical JSON structure.
Compare QR Code AI against other browser decoders across 1D labels, Data Matrix and built-in camera helpers; product lookup stays in your app.
| Capability | ZXing Browser | |||
|---|---|---|---|---|
Barcode formats | 1D + 2DQR Code AI decodes Code 128, Code 39, Code 93, Codabar, ITF, GS1 DataBar, GS1 DataBar Expanded, Telepen, EAN-13, EAN-8, UPC-A and UPC-E plus Data Matrix, PDF417, Aztec and MaxiCode. | 1D + 2DSelect the matching ZXing reader class: the multi-format reader covers 1D and 2D formats alongside a dedicated Data Matrix reader, depending on reader choice. | Built-in 1DCited built-in readers cover Code 128, EAN, UPC, Code 39 and other linear symbologies; third-party reader plugins sit outside this table. | 1D + Data MatrixCited format support lists Code 128, EAN, UPC and Data Matrix among others; enabled symbologies and backend settings must match your target labels. |
Data Matrix | Data MatrixQR Code AI decodes Data Matrix natively, giving 2D label coverage over the cited built-in 1D Quagga2 reader set. | Data MatrixBrowserDatamatrixCodeReader and the multi-format reader document Data Matrix decoding, an advantage for 2D labels over built-in 1D-only readers. | Built-in 1DQuagga2’s cited built-in reader set focuses on linear barcodes; this comparison excludes external plugins and makes no claim about third-party extensions. | Data MatrixData Matrix appears in the cited supported-format list, an advantage for 2D labels over built-in 1D-only readers; check your active backend and format options. |
Image input | Bytes + RGBAQR Code AI provides scan_image for encoded bytes and scan_frame for RGBA pixels, plus the /scan helper for named options. Your app passes inputs and filters detections. | Image sourcesZXing Browser exposes image-element, image-URL and canvas decoding methods using a reader matching your target formats. | Image callbackQuagga.decodeSingle processes a saved image and reports results through a callback; input sizing and decoder config still apply. | Local FileHtml5Qrcode.scanFile and scanFileV2 decode a local File directly, separate from the optional turnkey camera UI. |
Camera controls | Controller + overlayThe /camera and /camera-overlay modules add a capture controller, position tracker and live readout overlay while keeping decoding inside your Worker. User camera permission is still required. | Capture / stopProvides browser capture helpers and stop controls to cut down camera lifecycle wiring; user permission and UI flow still belong to your app. | Start / stopQuagga.start() begins video decoding and Quagga.stop() halts scanning and releases the active camera stream. | Start / stopThe lower-level Html5Qrcode API handles camera scanning while Html5QrcodeScanner adds an optional ready-made UI; camera permission still applies. |
Returned data | Text + payloadReturns each detection’s symbology, exact text string, raw bytes, recognised structured payloads (such as GS1 elements) and trace fields. Store identifiers strictly as strings. | Text + metadataOutputs decoded text, symbology format, corner points and format-specific metadata. | Text + locationDocumented output includes codeResult.code, format and localisation/decoder metadata. Always preserve identifiers as strings. | Text + formatThe callback passes decoded text alongside a result object identifying the detected format. |
Green ticks mark documented Data Matrix support, an advantage over the cited Quagga2 built-in 1D readers; plain text is neutral, including the camera helpers documented by all four libraries. Open underlined labels for details. The cited html5-qrcode revision states maintenance mode. This table is not a speed, accuracy or print-quality benchmark.
Sources: QR Code AI browser WASM API, ScanReport specification, ZXing Browser README, ZXing supported formats list, Quagga2 README, html5-qrcode README and html5-qrcode API docs
SDK catalogue, barcode strings, camera frames, offline decoding and licence.
The Barcode Scanner SDK is an open-source MIT library developers embed inside their own software to decode barcode images and live camera frames into structured data. Your app supplies file inputs or cameras, UI and follow-up actions. For quick one-off scanning without coding, use the online Barcode Scanner.
The Barcode SDK catalogue covers 10 published languages and runtimes: browser JavaScript/TypeScript, Node.js, Rust, Python, Flutter/Dart, Android (Kotlin/Java), iOS (Swift), .NET/C#, Go and PHP. JavaScript and TypeScript share one WebAssembly package, while the CLI ships separately. Every integration has its own setup guide.
Yes. The browser package provides scan_image for encoded bytes and scan_frame for raw RGBA pixels with width and height, while /camera and /camera-overlay add a capture controller and live overlay. Your app still requests camera permission and decides when to stop streaming.
The JavaScript quick start filters for Code 128, Code 39, EAN-13, EAN-8, UPC-A, UPC-E, ITF and Data Matrix. ITF-14 reports as itf, GS1-128 reports as code128 and ISBN codes carried in EAN-13 report as ean13 rather than separate decoder names. The engine also decodes Code 93, Codabar, GS1 DataBar, GS1 DataBar Expanded, Telepen, PDF417, Aztec and MaxiCode plus QR Code, Micro QR and rMQR.
It returns a ScanReport carrying each detection’s symbology, content.text, content.raw, recognised structured payloads and trace metadata. The JavaScript quick start maps these to format and text pairs such as code128 and STOCK-4827. Store every identifier strictly as text including leading zeros; parsed GS1 payloads add structure without looking up retail product records.
Yes. After loading, the browser WASM build decodes offline on-device with no QR Code AI account or cloud call. Native packages for Rust, Node.js, Python, .NET, Android, iOS and Flutter execute directly where your app runs. Because your surrounding app manages uploads, storage and catalogue lookups, local decoding itself is not a blanket privacy or offline guarantee.
Yes. Current engine releases and language bindings use the permissive MIT licence, letting you embed, modify and ship them in open-source or commercial software while preserving copyright and licence notices. Check the open-source licensing guide for retained third-party notices and older release terms.
No. Local SDK decoding needs neither a QR Code AI API key nor generation credits and stays separate from the managed creation service. On that platform, free creation limits and Premium apply to affected creation features, and the seven-day Premium trial starts upon creating the first dynamic QR code or Smart Link rather than a barcode. Directly encoded barcode data never expires, though decoding cannot revive an offline managed destination.
Handle an empty detections array as a normal scan result rather than an exception; the quick-start helper also returns [] when filtering out other symbologies such as QR codes. Clear stale output, prompt for a clearer image showing the full barcode and quiet zone, and handle invalid inputs or initialisation errors separately. Decoding never certifies printed-label quality.
Yes. Barcode Scanner and QR Code Scanner share the exact same packages published under the QR Code & Barcode Scanner engine, so one install decodes both barcodes and QR codes even inside the same image. This page focuses on barcode workflows; check the QR Code Scanner SDK for QR examples and quality diagnostics.