Open-Source Barcode Scanner SDK

Build barcode decoding directly into your software. One open-source on-device engine converts label images or camera frames into clean identifiers and symbologies for 1D and 2D barcodes plus QR codes in the same image.

import init, { scan_image } from
  "@qrcode-ai-com/qrcode-barcode-scanner-wasm";

await init();
const bytes = new Uint8Array(await file.arrayBuffer());
const report = scan_image(
  bytes, "frame", undefined, undefined, 1000
);
const barcode = report.detections
  .find(d => d.symbology === "code128");

console.log(barcode?.content.text);

Sample outputSTOCK-4827

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.

npm install @qrcode-ai-com/qrcode-barcode-scanner-wasm

Need to decode a barcode immediately? Open online reader

Barcode labels in. Clean app data out.

  • Linear and 2D matrix barcodes

    1D + 2D

  • Saved images and live camera frames

    Image + frame

  • SDK integration paths

    10

  • Open-source on-device engine

    MIT

An on-device barcode reader SDK for your software

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.

Decode barcodes from saved images and camera frames

Accepts both saved label files and RGBA camera frames, letting your app filter the symbologies you care about and handle each identifier cleanly.

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.

Scan live camera frames

Feed RGBA pixels to scan_frame or mount the browser /camera controller. Camera permissions and stream lifecycle stay fully under your app’s control.

Parse the scan report

Store symbology (like code128) and content.text as strings so leading zeros remain intact for validation or catalogue lookup.

Pick your Barcode Scanner SDK package

Select from 10 published SDK packages backed by the same core engine and report schema, from browser JS/TS to Android Kotlin/Java.

Package or source
@qrcode-ai-com/qrcode-barcode-scanner-wasm
Installation
npm install @qrcode-ai-com/qrcode-barcode-scanner-wasm
Details
Available on npm with TypeScript definitions and mirrored on jsDelivr, unpkg and esm.sh. Bundles a portable WASM binary alongside /auto, /scan, /camera, /camera-overlay and /node entrypoints; host the WASM asset with your app.
JavaScript barcode scanner guide

Package or source
@qrcode-ai-com/qrcode-barcode-scanner
Installation
npm install @qrcode-ai-com/qrcode-barcode-scanner
Details
Available on npm for Node.js 18+, bundling prebuilt native addons for macOS, Linux (GNU and musl) and Windows along with TypeScript types. Built for backend image decoding pipelines.
Node.js barcode scanner guide

Package or source
qrcode-barcode-scanner on PyPI / import qrcode_barcode_scanner
Installation
pip install qrcode-barcode-scanner
Details
Hosted on PyPI for Python 3.8+ with prebuilt binary wheels for macOS, Linux and Windows, requiring zero local Rust setup. Both scan and scan_frame return the scan report as a Python dict.
Python barcode scanner guide

Package or source
qr_barcode_scanner on pub.dev
Installation
flutter pub add qr_barcode_scanner
Details
Published by verified publisher qrcode-ai.com. Works with signed prebuilt native binaries through cargokit, or local builds using Rust and Android NDK r28+. Handles both encoded images and raw RGBA camera frames.
Flutter barcode scanner guide

Package or source
qrcode-barcode-scanner on JitPack
Installation
implementation("com.github.qrcode-ai-com:qrcode-barcode-scanner:0.12.2")
Details
Distributed via JitPack as a one-line Gradle dependency covering four Android ABIs with 16 KB page alignment for 64-bit targets. Calling scan yields the ScanReport as a JSON string. Not yet available on Maven Central.
Android barcode scanner guide

Package or source
qrcode-barcode-scanner-swift on Swift Package Index
Installation
.package(url: "https://github.com/qrcode-ai-com/qrcode-barcode-scanner-swift.git", from: "0.12.2")
Details
Add through Swift Package Manager and link the QRCodeBarcodeScanner product. SwiftPM fetches the checksummed prebuilt XCFramework automatically without needing a Rust toolchain.
iOS barcode scanner guide

Package or source
QRCodeAI.QRCodeBarcodeScanner on NuGet
Installation
dotnet add package QRCodeAI.QRCodeBarcodeScanner
Details
Distributed on NuGet with prebuilt native binaries spanning five desktop and server OS/architecture targets. Use Scanner.Scan for encoded image bytes or Scanner.ScanFrame for RGBA buffers.
.NET / C# barcode scanner guide

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.

JavaScript quick start: decode a barcode in the browser

Set up label capture and clean identifier handling. Expand the snippet below for exact code and package manager commands.

Wire up capture, loading states and output UI

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.

Decode a chosen barcode image

Install the browser package

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

Decode a chosen barcode image

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.

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

Sample output

Given a Code 128 label encoding STOCK-4827, the helper outputs:

JSON
[
  { "symbology": "code128", "text": "STOCK-4827" }
]

Barcode Scanner SDK references

Inspect the API, scan report contract and licensing notes, or explore every runtime in the GitBook documentation.

What your app gets back from a barcode

An inventory label and a retail code demonstrate how raw scans turn into structured application data.

A Code 128 graphic next to an output panel displaying content.text STOCK-4827 and symbology code128.

Preserve stock references verbatim

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.

An EAN-13 graphic next to an output panel displaying content.text 1234567890128 and symbology ean13.

Keep retail numbers as strings

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.

Adding barcode decoding to your product in three steps

Add the package for your stack, pass a sharp label image or frame and keep every decoded identifier intact.

  1. Step 1

    Pick and initialise your stack’s package

    Install the SDK targeting your web, backend or mobile runtime. On the web, load the WASM module once when scanning starts.

  2. Step 2

    Pass a label image or live frame

    Send image bytes to scan_image or RGBA pixels to scan_frame with the entire barcode and its quiet zone clearly visible.

  3. Step 3

    Handle values, empty scans and errors

    Store symbology and exact strings (leading zeros included), clear stale output on empty scans and catch errors separately.

Reading the barcode scan report structure

Rely on the detected symbology and decoded text for business logic; parsed identifiers and quality diagnostics cover different scopes.

Fields
detections[].symbology · content.text · content.raw
Meaning
Each detection records a symbology and exact string, with IDs like code128, ean13, upc_a and data_matrix. Store content.text as a string and keep content.raw whenever raw byte processing is required.

Field
detections[].payload
Meaning
The engine can parse recognised structures like GS1 Application Identifiers used on retail and logistics labels. Retain the original decoded text alongside parsed fields. Neither a GTIN nor any decoded ID includes product names, pricing or stock counts; query your own backend database for those.

Fields
score · hints · trace.budget_exhausted
Meaning
The frame profile skips scoring and outputs score null. Under full or fast, the score evaluates the first detection to gauge decoding margin; because QR codes sort ahead of barcodes in mixed images, the score applies to the QR symbol there. Treat this score strictly as a software check, never as zero when null and never as a formal print-quality certification.

Empty result
A valid scan report can hold zero detections, and the quick-start helper also returns [] when every symbol falls outside its eight-format allowlist (including QR codes). Prompt for a sharper image or frame and clear old output.
Error
Unreadable files, oversized images, initialisation problems and runtime exceptions follow the package’s error contract. Catch them cleanly and show an actionable retry or format hint.

Every field and null rule is documented in the report specification. All 10 packages share this identical JSON contract.

Browser barcode scanner libraries compared

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.

Browser APIs · pinned revisions · QR Code AI column updated 27 November 2026
CapabilityQR Code AIWASM · MITZXing Browser@zxing/browserQuagga2@ericblade/quagga2html5-qrcodehtml5-qrcode

Barcode formats

1D + 2D

Pick 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 1D

The documented built-in readers cover linear symbologies including Code 128, EAN, UPC and Code 39; external reader extensions are outside this comparison.

1D + Data Matrix

The 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 Matrix

BrowserDatamatrixCodeReader and the multi-format reader document Data Matrix support, advantageous for 2D label workflows over built-in 1D-only reader sets.

Built-in 1D

Quagga2’s cited built-in readers focus on linear barcodes; third-party plugins fall outside this matrix and are not ruled out.

Data Matrix

Data 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

Image sources

ZXing Browser exposes image-element, image-URL and canvas decoders paired with whichever reader matches your target symbologies.

Image callback

Quagga.decodeSingle decodes a single saved image via callback; input dimensions and decoder options still influence detection.

Local File

Html5Qrcode.scanFile and scanFileV2 decode a local File directly, separate from its optional turnkey camera scanner widget.

Camera controls

Capture / stop

The browser wrapper exposes video capture helpers and stop controls, trimming camera lifecycle code; user permission and UI prompts are still needed.

Start / stop

Quagga.start() launches live video scanning and Quagga.stop() halts decoding and releases the active camera stream.

Start / stop

The 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 + metadata

Decoded results provide text, barcode format, locator points and format-specific metadata.

Text + location

The documented callback returns codeResult.code and format alongside localisation and decoder metadata; keep identifiers as strings.

Text + format

The 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

Barcode Scanner SDK: common questions

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.