Open-Source Barcode Scanner SDK

Embed barcode reading directly in your own software. One open-source engine turns a label image or camera frame into a decoded value and format on the device, covering 1D and 2D barcodes as well as 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);

Example outputSTOCK-4827

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.

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

Need to scan a barcode straight away? Open the online reader

From barcode input to application data.

  • Linear and matrix barcodes

    1D + 2D

  • Saved images and camera frames

    Image + frame

  • SDK integration paths

    10

  • Open-source on-device engine

    MIT

A barcode reader SDK for your application

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.

Read barcodes from images and camera frames

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.

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.

Scan camera frames

Pass RGBA pixels to scan_frame or use the browser /camera controller. Your app retains full control over camera permissions and lifecycle.

Inspect the scan report

Read symbology (such as code128) and content.text as strings so leading zeros remain intact for downstream validation or lookup.

Choose your Barcode Scanner SDK integration

Select from 10 published SDK integrations sharing one engine and report contract, from browser JS/TS to Kotlin/Java for Android.

Package or source
@qrcode-ai-com/qrcode-barcode-scanner-wasm
Installation
npm install @qrcode-ai-com/qrcode-barcode-scanner-wasm
Details
Published on npm with TypeScript declarations and served via jsDelivr, unpkg and esm.sh. Ships a single portable WASM module plus /auto, /scan, /camera, /camera-overlay and /node entry points. Serve the WASM asset alongside your application.
JavaScript barcode scanner guide

Package or source
@qrcode-ai-com/qrcode-barcode-scanner
Installation
npm install @qrcode-ai-com/qrcode-barcode-scanner
Details
Published on npm for Node.js 18 and later, shipping pre-built native binaries for macOS, Linux (GNU and musl) and Windows alongside TypeScript declarations. Built for server-side image processing.
Node.js barcode scanner guide

Package or source
qrcode-barcode-scanner on crates.io
Installation
cargo add qrcode-barcode-scanner
Details
Published on crates.io and listed on Lib.rs. Configure a Scanner, select a profile and pass an ImageInput containing encoded bytes or raw pixels. Full API documentation is available on docs.rs.
Rust barcode scanner guide

Package or source
qrcode-barcode-scanner on PyPI / import qrcode_barcode_scanner
Installation
pip install qrcode-barcode-scanner
Details
Published on PyPI for Python 3.8 and later, with pre-built wheels for macOS, Linux and Windows so no Rust toolchain is required. scan and scan_frame return the scan report as a dict.
Python barcode scanner guide

Package or source
qr_barcode_scanner on pub.dev
Installation
flutter pub add qr_barcode_scanner
Details
Published under the verified publisher qrcode-ai.com. Supports signed pre-compiled native libraries via cargokit or local compilation with Rust and Android NDK r28+. Decodes 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
Published as an Android library on JitPack with a single-line Gradle dependency, four Android ABIs and 16 KB memory-page alignment for 64-bit targets. scan returns the ScanReport as a JSON string. Not published on Maven Central yet.
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
Install via Swift Package Manager and link the QRCodeBarcodeScanner library product. SwiftPM downloads the pre-built, checksummed XCFramework automatically, with no Rust toolchain needed.
iOS barcode scanner guide

Package or source
QRCodeAI.QRCodeBarcodeScanner on NuGet
Installation
dotnet add package QRCodeAI.QRCodeBarcodeScanner
Details
Published on NuGet with pre-built native libraries across five desktop and server OS/architecture targets. Call Scanner.Scan for encoded image bytes or Scanner.ScanFrame for RGBA pixels.
.NET & C# barcode scanner guide

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.

JavaScript quick start: read a barcode in the browser

Plan label capture and result handling. Expand the example to inspect the exact code and installation commands.

Prepare capture, loading and result controls

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.

Read a selected barcode image

Install the browser package

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

Read a selected barcode image

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.

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

Example output

For a Code 128 label encoding STOCK-4827, the function returns:

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

What your application receives from a barcode

An inventory reference and a retail identifier show how a decoded value becomes structured application data.

A Code 128 barcode label beside a result panel displaying content.text STOCK-4827 and symbology code128.

Keep an inventory reference intact

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.

An EAN-13 barcode label beside a result panel displaying content.text 1234567890128 and symbology ean13.

Preserve retail identifiers as strings

EAN-13 returns 1234567890128 and UPC-A preserves leading zeros such as 012345678905. Store values as text and query your own product database.

How to add barcode reading to your product

Install the package for your runtime, supply a clear barcode image or camera frame and keep the decoded identifier intact.

  1. Step 1

    Choose and initialise the matching package

    Install the package for your browser, server or mobile runtime. On the web, load WASM once on the client when scanning starts.

  2. Step 2

    Supply a label image or captured frame

    Pass image bytes to scan_image or RGBA pixels to scan_frame with the complete barcode and its quiet zone framed cleanly.

  3. Step 3

    Handle values, empty results and errors

    Retain the symbology and exact text (including leading zeros), clear stale output on empty scans and handle errors separately.

Understand the barcode scan report

Use the decoded format and text in your application logic. A parsed identifier and a quality judgement serve different scopes.

Fields
detections[].symbology · content.text · content.raw
Meaning
Each detection reports its symbology and decoded text. Symbology identifiers include code128, ean13, upc_a and data_matrix. Store the text as a string and retain the raw representation whenever byte-level processing matters.

Field
detections[].payload
Meaning
The engine can recognise structured content such as GS1 elements, the standard data fields used in retail and logistics barcodes. Keep the original text alongside parsed fields. A GTIN (the product number on a retail barcode) or any other decoded identifier does not supply a product name, price or stock record; your application requires a separate data source.

Fields
score · hints · trace.budget_exhausted
Meaning
The frame profile skips scoring and returns score null. With full or fast, the score evaluates the first code in the report and estimates how much margin it has before it stops scanning. A report lists QR codes before barcodes, so in an image holding both, the score applies to the QR code. The score is a software check rather than a print-quality grade for a barcode label: never treat null as zero or present it as hardware verification of printed labels.

Empty result
A valid report may contain no detections. The quick-start function can also return [] when every detection falls outside its eight-format filter, QR codes included. Ask for another readable image or camera frame and clear stale output.
Error
Invalid inputs (a file that is not a readable image, or an image exceeding the size limits), initialisation failures and other scan errors follow the installed package’s error contract. Catch them and offer a clear retry or input correction.

The report specification defines every field and its null handling. The JSON contract is identical across every package.

Compare browser barcode scanner libraries

Compare QR Code AI with browser decoders across 1D labels, Data Matrix and built-in camera helpers; product lookup stays in your app.

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

Barcode formats

1D + 2D

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

The cited built-in readers cover Code 128, EAN, UPC, Code 39 and other linear formats. External readers sit outside this comparison.

1D + Data Matrix

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

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

Quagga2’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 Matrix

Data 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

Image sources

ZXing Browser provides image-element, image-URL and canvas decoding methods paired with a reader matched to the required symbologies.

Image callback

Quagga.decodeSingle processes a single saved image and delivers its result through a callback. Image dimensions and decoder configuration still matter.

Local File

Html5Qrcode.scanFile and scanFileV2 process a local File. This is separate from the optional end-to-end camera scanner UI.

Camera controls

Capture / stop

The 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 / stop

Quagga.start() starts video processing and Quagga.stop() stops decoding and disconnects the active camera stream.

Start / stop

The low-level Html5Qrcode API handles camera scanning; Html5QrcodeScanner adds an optional ready-made interface. Camera permission is still required.

Returned data

Text + metadata

Results contain decoded text, barcode format, points and format-dependent metadata.

Text + location

The documented result includes codeResult.code and format plus localisation and decoder data. Keep identifiers as strings.

Text + format

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

Barcode Scanner SDK questions

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.