qrcode-rust/examples/encode_image.rs
2017-11-07 22:12:18 +08:00

17 lines
337 B
Rust

extern crate image;
extern crate qrcode;
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();
}