qrcode-rust/examples/encode_image.rs

17 lines
337 B
Rust
Raw Normal View History

2017-05-22 17:25:32 -05:00
extern crate image;
2017-11-07 02:23:50 -06:00
extern crate qrcode;
2017-05-22 17:25:32 -05:00
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();
}