[−][src]Type Definition embedded_graphics::image::Image8BPP
type Image8BPP<'a, C> = Image<'a, C, ImageType8BPP>;
8 bits per pixel image
Each byte of input data defines the on/off state for each pixel. This currently only supports monochrome displays, so if the pixel value is 0, it's off, anything above 0 is on.
You can convert an image to 8BPP for inclusion with include_bytes!()
using the following
Imagemagick command:
convert image.png -depth 8 gray:"image.raw"
Examples
Load an 8 bit per pixel image from a raw byte slice and draw it to a display
Note that images must be passed to Display#draw
by reference, or by explicitly calling
.into_iter()
on them, unlike other embedded_graphics objects.
use embedded_graphics::prelude::*; use embedded_graphics::image::Image8BPP; // Load `patch_8bpp.raw`, an 8BPP 4x4px image let image = Image8BPP::new(include_bytes!("../../../assets/patch_8bpp.raw"), 4, 4); // Equivalent behaviour display.draw(&image); display.draw(image.into_iter());
Trait Implementations
impl<'a, C> IntoIterator for &'a Image8BPP<'a, C> where
C: PixelColor,
[src]
C: PixelColor,