Macro egui::include_image

source ·
macro_rules! include_image {
    ($path: literal) => { ... };
}
Expand description

Include an image in the binary.

This is a wrapper over include_bytes!, and behaves in the same way.

It produces an ImageSource which can be used directly in Ui::image or Image::new:

ui.image(egui::include_image!("../assets/ferris.png"));
ui.add(
    egui::Image::new(egui::include_image!("../assets/ferris.png"))
        .max_width(200.0)
        .rounding(10.0),
);

let image_source: egui::ImageSource = egui::include_image!("../assets/ferris.png");
assert_eq!(image_source.uri(), Some("bytes://../assets/ferris.png"));