qr_code 0.3.0

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

qr_code

crates.io MIT OR Apache 2.0

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

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):


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