#qrcode

qr_code

QR code encoder in Rust, support structured append (data in multiple qrcodes)

8 releases (breaking)

new 0.16.0 Oct 16, 2020
0.15.0 Oct 16, 2020
0.6.0 Oct 15, 2020
0.5.0 Oct 11, 2020
0.1.0 Oct 10, 2020

#49 in Images

46 downloads per month
Used in 2 crates (via firma)

MIT/Apache

610KB
11K SLoC

qr_code

crates.io MIT OR Apache 2.0

QR code and Micro QR code encoder in Rust. Documentation.

This lib forked https://docs.rs/qrcode mainly because of lack of support to structured QR code (multiple QR codes) even if the minimal change required has been pushed https://github.com/kennytm/qrcode-rust/pull/44

Moreover dependencies image, checked_int_cast and module render has been removed with a view to simplicity.

Example

Bmp image generation

requires bmp feature

let qr_code = qr_code::QrCode::new(b"Hello").unwrap();
let bmp = qr_code.to_bmp();
bmp.write(std::fs::File::create("test.bmp").unwrap()).unwrap();

Generate this image:

test

Looks small?

Many context supports rescaling mode specific for pixelated images, for example in html image-rendering: pixelated;

As an alternative see method Bmp::mul and Bmp::add_whitespace

Unicode string generation

let qr_code = qr_code::QrCode::new(b"Hello").unwrap();
println!("{}", qr_code.to_string(false));

Generates this output (looks better in terminal):


   █▀▀▀▀▀█  ▀▀▀█ █▀▀▀▀▀█
   █ ███ █ █ █ ▀ █ ███ █
   █ ▀▀▀ █ ██ ▄▀ █ ▀▀▀ █
   ▀▀▀▀▀▀▀ █ █ ▀ ▀▀▀▀▀▀▀
   ▀ ▀█▀▀▀ ▄▀ █▄▄█▀▀██ ▄
     █▀▀█▀▄▄▀█▄█▄█▀ ██▀ 
    ▀▀▀  ▀▀█▀▀ █  █ ▄  ▀
   █▀▀▀▀▀█ ▄▀▄▀ ▀ ▄█▄██ 
   █ ███ █ █▄ █▄█▄▄▀▄ ▀ 
   █ ▀▀▀ █ ▀█ ▄█▄█▀▄▄█  
   ▀▀▀▀▀▀▀ ▀▀  ▀   ▀  ▀ 

Dependencies