Scan a saved image
Pass encoded image bytes from an upload, screenshot or label photo into scan_image. The Code 128 sample yields STOCK-4827, and the quick start retains other formats too.
1D + 2D
Image + frame
10
MIT
A single 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 and detected formats.
Both Barcode Scanner and QR Code Scanner SDKs use the exact same 10 packages. Need a quick manual scan without coding? Try the online Barcode Scanner.
Accepts both saved label files and RGBA camera frames, letting your app filter the symbologies you care about and handle each identifier cleanly.
Pass encoded image bytes from an upload, screenshot or label photo into scan_image. The Code 128 sample yields STOCK-4827, and the quick start retains other formats too.
Feed RGBA pixels to scan_frame or mount the browser /camera controller. Camera permissions and stream lifecycle stay fully under your app’s control.
Store symbology (like code128) and content.text as strings so leading zeros remain intact for validation or catalogue lookup.
Select from 10 published SDK packages backed by the same core engine and report schema, from browser JS/TS to Android Kotlin/Java.
Packages and registries checked on 27 November 2026. Cross-language references live in the GitBook documentation and the scanner repository, while a live browser demo runs on GitHub Pages. Go and PHP wrap the local qrscan executable; the Barcode Scanner CLI is a standalone tool.
Set up label capture and clean identifier handling. Expand the snippet below for exact code and package manager commands.
Your app owns file pickers or camera capture, progress states and result controls. Initialise WASM once and run synchronous scanning inside a Web Worker; for live video, extract RGBA frames and provide explicit stop controls.
Always keep decoded values as strings so leading zeros survive. Wipe stale output after an empty scan and keep empty results distinct from exceptions.
Continue to the JavaScript barcode scanner guide for the complete browser walkthrough.
To verify the snippet locally, create a barcode with Barcode Generator using Code 128 and STOCK-4827, save it as PNG and check the decoded output against your input.
Use your preferred package manager; all three fetch the exact same MIT-licensed WebAssembly package from npm.
Before shipping the library, inspect the licensing guide. To test scanning without local setup, open the Vite example in StackBlitz, which installs this package and decodes locally in your browser.
npm install @qrcode-ai-com/qrcode-barcode-scanner-wasm
Initialise the WASM module once, then pass a browser File into readBarcodeImage. It keeps Code 128, Code 39, EAN-13, EAN-8, UPC-A, UPC-E, ITF and Data Matrix entries, returning exact symbology and text (or an empty array if nothing matches). To accept more symbologies, append their IDs to barcodeFormats: pdf417, aztec, maxi_code, code93, codabar, data_bar, data_bar_expanded or telepen. Check the report specification for every ID.
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 sets the scan profile: "frame" runs decode-only scanning, whereas "full" and "fast" also calculate a scannability score on the first detection.
Leaving both dimension arguments undefined applies the engine defaults used by the official browser demo: 10,000 px per side and 64,000,000 total pixels, easily fitting standard mobile photos up to 48 megapixels. Oversized files are rejected with QRS-002 or QRS-003 rather than downscaled. On public server endpoints, pass tighter limits such as the documented 4,096 px and 16,000,000 pixels.
The 1,000 ms budget bounds decode work rather than total response time, because image parsing happens before the budget starts. Run synchronous WASM scans inside a Web Worker to keep your UI responsive.
Given a Code 128 label encoding STOCK-4827, the helper outputs:
[
{ "symbology": "code128", "text": "STOCK-4827" }
]
Inspect the API, scan report contract and licensing notes, or explore every runtime in the GitBook documentation.
An inventory label and a retail code demonstrate how raw scans turn into structured application data.

The Code 128 sample outputs STOCK-4827 with symbology code128. Retaining both lets your backend validate the format and forward the exact code to an inventory or asset tracker.

EAN-13 yields 1234567890128 while UPC-A preserves leading zeros such as 012345678905. Store identifiers as text and look them up in your product catalogue.
Add the package for your stack, pass a sharp label image or frame and keep every decoded identifier intact.
Install the SDK targeting your web, backend or mobile runtime. On the web, load the WASM module once when scanning starts.
Send image bytes to scan_image or RGBA pixels to scan_frame with the entire barcode and its quiet zone clearly visible.
Store symbology and exact strings (leading zeros included), clear stale output on empty scans and catch errors separately.
Rely on the detected symbology and decoded text for business logic; parsed identifiers and quality diagnostics cover different scopes.
Every field and null rule is documented in the report specification. All 10 packages share this identical JSON contract.
See how QR Code AI stacks up against popular browser decoders on 1D formats, Data Matrix support and camera helpers; product lookup stays in your app.
| Capability | ZXing Browser | |||
|---|---|---|---|---|
Barcode formats | 1D + 2DQR Code AI supports Code 128, Code 39, Code 93, Codabar, ITF, GS1 DataBar, GS1 DataBar Expanded, Telepen, EAN-13, EAN-8, UPC-A and UPC-E alongside Data Matrix, PDF417, Aztec and MaxiCode. | 1D + 2DPick the matching ZXing reader: the multi-format reader spans 1D and 2D symbologies, and a dedicated Data Matrix reader is documented too. Exact coverage depends on the reader chosen. | Built-in 1DThe documented built-in readers cover linear symbologies including Code 128, EAN, UPC and Code 39; external reader extensions are outside this comparison. | 1D + Data MatrixThe cited format list covers Code 128, EAN, UPC, Data Matrix and others; ensure enabled symbologies and backend settings align with your workflow. |
Data Matrix | Data MatrixQR Code AI decodes 2D Data Matrix labels natively, offering an advantage over the documented Quagga2 built-in 1D reader list. | Data MatrixBrowserDatamatrixCodeReader and the multi-format reader document Data Matrix support, advantageous for 2D label workflows over built-in 1D-only reader sets. | Built-in 1DQuagga2’s cited built-in readers focus on linear barcodes; third-party plugins fall outside this matrix and are not ruled out. | Data MatrixData Matrix appears in the cited supported formats, an advantage when 2D labels are needed over built-in 1D reader lists; verify your active backend and format options. |
Image input | Bytes + RGBAQR Code AI provides scan_image for encoded bytes and scan_frame for RGBA pixels, alongside /scan for named options. Your app passes the image or frame and filters the barcode results to retain. | Image sourcesZXing Browser exposes image-element, image-URL and canvas decoders paired with whichever reader matches your target symbologies. | Image callbackQuagga.decodeSingle decodes a single saved image via callback; input dimensions and decoder options still influence detection. | Local FileHtml5Qrcode.scanFile and scanFileV2 decode a local File directly, separate from its optional turnkey camera scanner widget. |
Camera controls | Controller + overlayThe /camera and /camera-overlay entrypoints provide a capture controller, position tracker and interactive readout overlay. Decoding stays inside your module Worker while camera permission remains user-granted. | Capture / stopThe browser wrapper exposes video capture helpers and stop controls, trimming camera lifecycle code; user permission and UI prompts are still needed. | Start / stopQuagga.start() launches live video scanning and Quagga.stop() halts decoding and releases the active camera stream. | Start / stopThe low-level Html5Qrcode API controls live video scanning, while Html5QrcodeScanner layers an optional ready-made UI on top; camera permission is still required. |
Returned data | Text + payloadThe scan report exposes symbology, exact decoded text, raw bytes, recognised structured payloads like GS1 fields and execution trace data. Keep identifiers as strings. | Text + metadataDecoded results provide text, barcode format, locator points and format-specific metadata. | Text + locationThe documented callback returns codeResult.code and format alongside localisation and decoder metadata; keep identifiers as strings. | Text + formatThe callback passes decoded text along with a result object indicating the detected barcode format. |
Green checks highlight documented Data Matrix support, an advantage over the cited Quagga2 built-in 1D readers; plain text is neutral, including the camera helpers all four libraries offer. Select underlined labels to inspect details. The cited html5-qrcode revision notes maintenance mode. This matrix is not a speed, accuracy or print-quality benchmark.
Sources: QR Code AI browser API, report specification, ZXing Browser README, ZXing format list, Quagga2 README, html5-qrcode README and html5-qrcode API
Language packages, barcode strings, camera capture, local decoding and licensing.
A barcode scanner SDK is a software library embedded directly inside your own app to decode barcode images or camera frames into structured data. Your application owns file or camera input, UI controls and downstream actions. This page documents QR Code AI’s open-source MIT Barcode Scanner SDK; for a ready-to-use browser utility without coding, open the online Barcode Scanner.
The SDK catalogue spans 10 published languages and runtimes: browser JavaScript/TypeScript, Node.js, Rust, Python, Flutter/Dart, Android, iOS, .NET/C#, Go and PHP. JavaScript and TypeScript share the browser WASM package, while the CLI ships as a standalone utility. Each runtime has its own step-by-step guide.
Yes. The browser build provides scan_image for encoded file bytes and scan_frame for raw RGBA pixel buffers with dimensions. Its /camera and /camera-overlay entrypoints add a capture controller and live overlay. Your application stays responsible for requesting camera access and stopping the video stream.
The JavaScript quick start retains Code 128, Code 39, EAN-13, EAN-8, UPC-A, UPC-E, ITF and Data Matrix detections. Note that ITF-14 decodes as ITF, GS1-128 as Code 128 and ISBN numbers inside EAN-13 rather than separate symbology names. The underlying engine also handles Code 93, Codabar, GS1 DataBar, GS1 DataBar Expanded, Telepen, PDF417, Aztec and MaxiCode, along with QR Code, Micro QR and rMQR.
Every call returns a scan report holding detections with symbology, content.text and raw bytes, plus parsed payloads and trace info. The browser quick start yields pairs of format and string such as code128 and STOCK-4827. Always keep values as strings so leading zeros remain intact; a recognised GS1 payload adds structured fields without fetching product records.
Yes. Once loaded, the browser WebAssembly package decodes purely on the client device without a QR Code AI login or hosted API calls. Similarly, the Rust, Node.js, Python, .NET, Android, iOS and Flutter bindings run inside your own process. Because your host app still governs uploads, logging, storage and catalogue lookups, local decoding alone is not a blanket privacy or offline guarantee.
Yes. Current releases of the core engine and every language binding ship under the open-source MIT licence, allowing commercial and proprietary usage, customisation and redistribution provided copyright and permission notices remain intact. Check the licensing guide for retained third-party notices and earlier release terms.
No. Local SDK decoding needs neither a QR Code AI generation API key nor creation credits, as SDK licensing is completely separate from the managed creation service. On the creation platform, free creation limits and Premium apply to affected creation features; the seven-day Premium trial starts with your first dynamic QR code or Smart Link, not barcode creation. Directly encoded barcode strings never expire after that trial, and local decoding cannot restore an unavailable managed destination.
Treat an empty detections list as a normal valid scan outcome. The quick-start snippet also returns [] whenever detected codes fall outside its eight-format filter, including QR codes. Prompt users for a crisper image showing the full barcode and quiet zone, and clear stale output. Catch invalid inputs (unreadable or oversized files) and initialisation exceptions separately. Remember a clean decode is not a hardware print-quality certificate.
Yes. Barcode Scanner and QR Code Scanner share the exact same packages published under the unified QR Code & Barcode Scanner engine. A single installation decodes both barcodes and QR codes, even within the same image. This guide focuses on barcode workflows, whereas the QR Code Scanner SDK covers QR examples and QR quality diagnostics.