#qrcode #scanner #barcode #scan #zbar

sys zbar-rust

High-level and low-level ZBar binding for the Rust language

15 releases

0.0.18 Apr 22, 2021
0.0.16 Mar 22, 2021
0.0.14 Jul 29, 2020
0.0.7 Sep 17, 2019
0.0.5 Nov 14, 2018

#399 in Encoding

Download history 125/week @ 2021-08-11 139/week @ 2021-08-18 120/week @ 2021-08-25 120/week @ 2021-09-01 143/week @ 2021-09-08 92/week @ 2021-09-15 108/week @ 2021-09-22 140/week @ 2021-09-29 117/week @ 2021-10-06 87/week @ 2021-10-13 109/week @ 2021-10-20 72/week @ 2021-10-27 114/week @ 2021-11-03 96/week @ 2021-11-10 79/week @ 2021-11-17 83/week @ 2021-11-24

381 downloads per month

LGPL-2.1

21KB
479 lines

ZBar Rust

CI

High-level and low-level ZBar binding for the Rust language.

Compilation

To compile this crate, you need to compile the ZBar library first. You can install ZBar in your operating system, or in somewhere in your file system. As for the latter, you need to set the following environment variables to link the ZBar library:

  • ZBAR_LIB_DIRS: The directories of library files, like -L. Use : to separate.
  • ZBAR_LIBS: The library names that you want to link, like -l. Use : to separate. Typically, it is iconv:zbar.
  • ZBAR_INCLUDE_DIRS: The directories of header files, like -i. Use : to separate.

Examples

extern crate zbar_rust;
extern crate image;

use zbar_rust::ZBarImageScanner;

use image::GenericImageView;

let img = image::open(INPUT_IMAGE_PATH).unwrap();

let (width, height) = img.dimensions();

let luma_img = img.to_luma();

let luma_img_data: Vec<u8> = luma_img.to_vec();

let mut scanner = ZBarImageScanner::new();

let results = scanner.scan_y800(&luma_img_data, width, height).unwrap();

for result in results {
    println!("{}", String::from_utf8(result.data).unwrap())
}

More examples are in the examples folder.

Crates.io

https://crates.io/crates/zbar-rust

Documentation

https://docs.rs/zbar-rust

License

LGPL-2.1

Dependencies

~0.7–1.2MB
~29K SLoC