Scan an image
Pass encoded image bytes from an upload, screenshot or label to scan_image. The Code 128 example returns STOCK-4827; the quick start also keeps other common formats.
1D + 2D
Image + frame
10
MIT
One open-source, MIT-licensed Rust engine decodes 16 linear and 2D barcode formats (plus QR codes) from saved images or camera frames, returning exact identifier strings alongside their detected symbologies.
The Barcode and QR Code Scanner SDKs share the exact same 10 packages. Need a quick scan without writing code? Open the online Barcode Scanner.
The engine accepts saved image files and raw RGBA frames. Your application decides which barcode formats to keep and how to handle their decoded values.
Pass encoded image bytes from an upload, screenshot or label to scan_image. The Code 128 example returns STOCK-4827; the quick start also keeps other common formats.
Pass RGBA pixels to scan_frame or use the browser /camera controller. Your app retains full control over camera permissions and lifecycle.
Read symbology (such as code128) and content.text as strings so leading zeros remain intact for downstream validation or lookup.
Select from 10 published SDK integrations sharing one engine and report contract, from browser JS/TS to Kotlin/Java for Android.
Packages and registries verified on 27 November 2026. Full cross-language guides live in the GitBook documentation and the scanner repository, and you can test the browser build on GitHub Pages. The Go and PHP packages drive the installed qrscan command; the Barcode Scanner CLI is a separate tool.
Plan label capture and result handling. Expand the example to inspect the exact code and installation commands.
Your app provides the file input or camera capture, loading indicator and result controls. Initialise WASM once and run synchronous scanning inside a Web Worker. For camera input, capture RGBA frames and manage camera stop controls.
Store each decoded identifier as a string so leading zeros stay intact. Clear stale output after an unsuccessful scan and distinguish empty results from errors.
Follow the JavaScript barcode scanner guide for the complete browser workflow.
To test the browser example, create a barcode with Barcode Generator using Code 128 and STOCK-4827, download it as a PNG and compare the decoded text against your input.
Choose a package manager. Each command installs the same MIT-licensed WebAssembly package from npm.
Before integrating the engine, review its licensing guide. To try the scanner before installing anything, open the Vite example on StackBlitz: it installs this package and scans directly in your browser.
npm install @qrcode-ai-com/qrcode-barcode-scanner-wasm
Initialise the WASM module once, then pass a browser File to readBarcodeImage. The function keeps Code 128, Code 39, EAN-13, EAN-8, UPC-A, UPC-E, ITF and Data Matrix detections. It returns their exact symbology and text; an unmatched image returns an empty array. To keep other formats, add their symbology identifiers to barcodeFormats: pdf417, aztec, maxi_code, code93, codabar, data_bar, data_bar_expanded or telepen. The report specification lists every identifier.
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 argument selects the scan profile: "frame" only decodes, whereas "full" and "fast" also calculate a scannability score for the first code in the report.
The two undefined arguments leave the image size limits at the engine’s defaults, just as in the scanner’s own browser example: 10,000 px per side and 64,000,000 pixels. An ordinary mobile phone photo of a label, up to 48 megapixels, stays well within them. An image exceeding either limit is rejected with an input error (QRS-002 or QRS-003): it is not resized. On a server accepting images from the public, pass lower limits: the scanner’s documentation uses 4,096 px and 16,000,000 pixels.
The 1,000 ms work budget is a configuration setting, not a latency guarantee; image decoding takes place before that budget starts. Run this synchronous WASM work inside a Web Worker to keep an interactive UI responsive.
For a Code 128 label encoding STOCK-4827, the function returns:
[
{ "symbology": "code128", "text": "STOCK-4827" }
]
API, scan report and licensing references, or browse every runtime in the GitBook documentation.
An inventory reference and a retail identifier show how a decoded value becomes structured application data.

The Code 128 example returns STOCK-4827 with symbology code128. Retain both fields so your application can validate the format and pass the exact reference to an inventory or asset system.

EAN-13 returns 1234567890128 and UPC-A preserves leading zeros such as 012345678905. Store values as text and query your own product database.
Install the package for your runtime, supply a clear barcode image or camera frame and keep the decoded identifier intact.
Install the package for your browser, server or mobile runtime. On the web, load WASM once on the client when scanning starts.
Pass image bytes to scan_image or RGBA pixels to scan_frame with the complete barcode and its quiet zone framed cleanly.
Retain the symbology and exact text (including leading zeros), clear stale output on empty scans and handle errors separately.
Use the decoded format and text in your application logic. A parsed identifier and a quality judgement serve different scopes.
The report specification defines every field and its null handling. The JSON contract is identical across every package.
Compare QR Code AI with 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 a suitable ZXing reader: the multi-format reader handles 1D and 2D, with a dedicated Data Matrix reader also documented. Coverage depends on the chosen reader. | Built-in 1DThe cited built-in readers cover Code 128, EAN, UPC, Code 39 and other linear formats. External readers sit outside this comparison. | 1D + Data MatrixThe cited supported-format list includes Code 128, EAN, UPC and Data Matrix alongside other formats. Enabled formats and backend configuration must match the intended workflow. |
Data Matrix | Data MatrixQR Code AI decodes Data Matrix labels, offering a 2D label option compared with the cited Quagga2 built-in 1D reader set. | Data MatrixBrowserDatamatrixCodeReader and the multi-format reader document this 2D label path, an advantage whenever Data Matrix is required over the cited built-in 1D reader set. | Built-in 1DQuagga2’s cited built-in reader list covers linear formats. This comparison excludes external reader plug-ins and does not suggest they can never add Data Matrix. | Data MatrixData Matrix appears in the cited supported-format list, an advantage for workflows needing 2D labels over the cited built-in 1D reader set. Verify the configured backend and format selection. |
Image input | Bytes + RGBAQR Code AI exposes scan_image for encoded image bytes and scan_frame for RGBA pixels, plus the /scan helper for named options. Your application supplies the file or frame and selects which barcode detections to keep. | Image sourcesZXing Browser provides image-element, image-URL and canvas decoding methods paired with a reader matched to the required symbologies. | Image callbackQuagga.decodeSingle processes a single saved image and delivers its result through a callback. Image dimensions and decoder configuration still matter. | Local FileHtml5Qrcode.scanFile and scanFileV2 process a local File. This is separate from the optional end-to-end camera scanner UI. |
Camera controls | Controller + overlayThe /camera and /camera-overlay entries provide a capture controller, a tracker of measured positions and an overlay with a readout of the selected code. Decoding remains in your module Web Worker, and camera access still requires the user’s permission. | Capture / stopThe browser layer provides capture methods and stop controls, cutting down application camera and lifecycle wiring. Camera permission and a user-facing flow are still required. | Start / stopQuagga.start() starts video processing and Quagga.stop() stops decoding and disconnects the active camera stream. | Start / stopThe low-level Html5Qrcode API handles camera scanning; Html5QrcodeScanner adds an optional ready-made interface. Camera permission is still required. |
Returned data | Text + payloadThe scan report provides each detection’s symbology, exact decoded text and raw bytes, recognised structured payloads (such as GS1 data) and trace fields. Keep identifiers as strings. | Text + metadataResults contain decoded text, barcode format, points and format-dependent metadata. | Text + locationThe documented result includes codeResult.code and format plus localisation and decoder data. Keep identifiers as strings. | Text + formatThe scan callback returns decoded text alongside a result describing 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 full details. The cited html5-qrcode revision reports maintenance mode. This table is not a speed, accuracy or print-quality benchmark.
Sources: QR Code AI browser API, report specification, ZXing Browser README, ZXing supported formats list, Quagga2 README, html5-qrcode README and html5-qrcode API reference.
SDK integrations, barcode values, camera input, local decoding and licensing.
A barcode scanner SDK is a software library that developers embed in their own application to read barcode images or camera frames and return decoded data. Your app supplies the file input or camera, interface and follow-up action. This page covers barcode integration with QR Code AI’s open-source, MIT-licensed Barcode Scanner SDK; the online Barcode Scanner is the ready-to-use web reader.
The catalogue covers 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 one browser package, while the CLI is a separate tool. Each SDK integration includes its own dedicated setup guide.
Yes. The browser package exposes scan_image for encoded image bytes and scan_frame for RGBA pixels with width and height. Its /camera and /camera-overlay entry points add a live capture controller and a selection overlay. Your application still requests camera permission and decides when scanning stops.
The JavaScript quick start keeps eight symbologies: Code 128, Code 39, EAN-13, EAN-8, UPC-A, UPC-E, ITF and Data Matrix. ITF-14 uses ITF, GS1-128 uses Code 128 and an ISBN may be carried in EAN-13; those label conventions are not 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.
The scan report returns detections containing symbology, content.text and raw content, alongside parsed payload structures and trace fields. The JavaScript quick start maps each match to a format and text pair, such as code128 and STOCK-4827. Keep identifiers as strings so leading zeros remain intact. A recognised GS1 payload adds structured fields, without fetching product records.
Yes. Once the browser WASM package has loaded, decoding runs locally on the device with no QR Code AI account, sign-in or hosted decoding request. The Rust, Node.js, Python, .NET, Android, iOS and Flutter packages execute wherever your application invokes them. Your application controls uploads, analytics, storage and product-database lookups, so local decoding alone is not a blanket privacy or offline guarantee.
Yes. Current releases of the scanner engine and language bindings are open source under the MIT licence, permitting use, modification and redistribution in open-source or proprietary commercial projects provided you retain the copyright and permission notices. Check the licensing guide for retained third-party notices and the terms shipped with earlier versions.
No. Local SDK decoding needs neither a QR Code AI generation API key nor creation credits. SDK licensing is separate from the creation platform. On that platform, free creation limits and Premium apply to the affected creation features; the seven-day Premium trial begins with the first dynamic QR code or Smart Link, not barcode creation. A directly encoded barcode value does not expire after that trial. Decoding cannot restore an unavailable managed destination.
Treat an empty detections array as a normal, valid scan outcome. The quick-start example also returns [] when every detected code falls outside its format filter, including QR codes. Prompt the user for a clearer image with the entire barcode and its blank quiet-zone margin visible, and clear any stale output. Handle invalid inputs (an unreadable file or an image exceeding the size limits) and initialisation or scan exceptions separately. A successful decode is not a hardware print-quality certificate for a printed label.
Yes. Barcode Scanner and QR Code Scanner ship in the same packages, published as the QR Code & Barcode Scanner engine. A single installation decodes both barcodes and QR codes, including when both appear in the same image. This page focuses on barcode examples; the QR Code Scanner SDK covers QR examples and QR quality diagnostics.