Macro imageproc::rgb_image [] [src]

macro_rules! rgb_image {
    () => { ... };
    ($( $( [$r: expr, $g: expr, $b: expr]),*);*) => { ... };
}

Helper for defining RGB images with u8 subpixels. Pixels are delineated by square brackets, columns are separated by commas and rows are separated by semi-colons.

Calls ImageBuffer::from_raw.

Examples

use image::RgbImage;

let image = rgb_image!(
    [1,  2,  3], [ 4,  5,  6];
    [7,  8,  9], [10, 11, 12]);

let equivalent = RgbImage::from_raw(2, 2, vec![
    1,  2,  3,  4,  5,  6,
    7,  8,  9, 10, 11, 12
]).unwrap();

assert_pixels_eq!(image, equivalent);