zedbar

Fast QR code and barcode scanner for Rust and Node.js

A fork of ZBar ported from C to Rust. Use it in your Rust projects or in Node.js via WebAssembly.

Try It

Drop an image to scan barcodes and QR codes directly in your browser using WebAssembly.

Drop or paste an image here, or click to select

PNG, JPEG, GIF, WebP, BMP

Supported Formats

2D Codes

  • QR Code
  • SQ Code

EAN/UPC

  • EAN-13 / EAN-8
  • UPC-A / UPC-E
  • ISBN-10 / ISBN-13

Code Family

  • Code 128
  • Code 93
  • Code 39
  • Codabar

Industrial

  • Interleaved 2 of 5
  • GS1 DataBar

Installation

Command-line Tool

Install the zedbarimg CLI tool (similar to zbarimg):

cargo install zedbar

Scan images from the command line:

zedbarimg image.png
zedbarimg --quiet barcode.jpg

Library Usage

Add zedbar to your Cargo.toml:

[dependencies]
zedbar = "0.2"
use zedbar::{Scanner, Image, DecoderConfig};
use zedbar::config::{QrCode, Ean13};

// Create a scanner with specific formats
let config = DecoderConfig::new()
    .enable(QrCode)
    .enable(Ean13);
let mut scanner = Scanner::with_config(config);

// Load an image (grayscale, 1 byte per pixel)
let mut image = Image::from_gray(&grayscale_data, width, height)?;

// Scan for barcodes
for symbol in scanner.scan(&mut image) {
    println!("{:?}: {}", symbol.symbol_type(), symbol.text().unwrap());
}

See the API documentation for more details.