quircs

Crates.ioquircs
lib.rsquircs
version0.10.2
sourcesrc
created_at2020-06-07 22:36:19.696514
updated_at2024-01-22 13:43:09.142176
descriptionQR code detection and scanning. Pure Rust.
homepagehttps://github.com/dignifiedquire/quircs
repositoryhttps://github.com/dignifiedquire/quircs
max_upload_size
id251121
size121,780
Friedel Ziegelmayer (dignifiedquire)

documentation

https://docs.rs/qurics/

README

quircs

QR Scanner in Rust.

Crates.io version Download docs.rs docs CI status

API Docs | Releases


Ported from quirc.

Example

// open the image from disk
let img = image::open("tests/data/Hello+World.png").unwrap();

// convert to gray scale
let img_gray = img.into_luma();

// create a decoder
let mut decoder = quircs::Quirc::default();

// identify all qr codes
let codes = decoder.identify(img_gray.width() as usize, img_gray.height() as usize, &img_gray);

for code in codes {
    let code = code.expect("failed to extract qr code");
    let decoded = code.decode().expect("failed to decode qr code");
    println!("qrcode: {}", std::str::from_utf8(&decoded.payload).unwrap());
}

CLI Example

$ cargo build --release --example qrtest
$ qrtest <path-to-image>
Commit count: 62

cargo fmt