Macro overlay_image

Source
macro_rules! overlay_image {
    ($qr_code:expr, $image_path:expr) => { ... };
}
Expand description

Re-exported main qrc module from qrc for QR code generation. Overlays an image (e.g., a logo) at the center of the QR code.

This is particularly useful for branding purposes, allowing the inclusion of a company logo within the QR code.

§Parameters

  • $qr_code:expr: QRCode instance to which the image will be overlaid.
  • $image_path:expr: Path to the image file to overlay.

§Example

use qrc::{QRCode, overlay_image};
use image::{RgbaImage, ImageBuffer, Rgba};

let qr_code = QRCode::new("some data".as_bytes().to_vec());
// Mock an image (e.g., a small red square)
let logo = ImageBuffer::from_pixel(10, 10, Rgba([255, 0, 0, 255]));

let qr_with_logo = overlay_image!(qr_code, &logo); // Use the macro for overlaying the image