qrcode-rust/examples/encode_image.rs
2017-05-23 06:56:22 +08:00

17 lines
337 B
Rust

extern crate qrcode;
extern crate image;
use qrcode::QrCode;
use image::Luma;
fn main() {
// Encode some data into bits.
let code = QrCode::new(b"01234567").unwrap();
// Render the bits into an image.
let image = code.render::<Luma<u8>>().build();
// Save the image.
image.save("/tmp/qrcode.png").unwrap();
}