1.3 KiB
1.3 KiB
qrcode-rust
QR code and Micro QR code encoder in Rust. Documentation.
Cargo.toml
[dependencies]
qrcode = "0.4"
The default settings will depend on the image
crate. If you don't need image generation capability, disable the default-features
:
[dependencies]
qrcode = { version = "0.4", default-features = false }
Example
This code:
extern crate qrcode;
extern crate image;
use qrcode::QrCode;
use image::GrayImage;
fn main() {
// Encode some data into bits.
let code = QrCode::new(b"01234567").unwrap();
// Render the bits into an image.
let image: GrayImage = code.render().to_image();
// Save the image.
image.save("/tmp/qrcode.png").unwrap();
}
Generates this image: