[−][src]Type Definition embedded_graphics::image::Image16BPP
type Image16BPP<'a, C> = Image<'a, C, ImageType16BPP>;
16 bits per pixel image
Every two bytes define the color for each pixel.
You can convert an image to 16BPP for inclusion with include_bytes!()
doing the following
convert image.png -flip -flop -type truecolor -define bmp:subtype=RGB565 -resize '64x64!' -depth 16 -strip image.bmp
then
tail -c $bytes image.bmp > image.raw // where $bytes is w * h * 2
This will remove the BMP header leaving the raw pixel data
E.g 64x64 image will have 64 * 64 * 2
bytes of raw data.
Examples
Load a 16 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::Image16BPP; // Load `patch_16bpp.raw`, a 16BPP 4x4px image let image = Image16BPP::new(include_bytes!("../../../assets/patch_16bpp.raw"), 4, 4); // Equivalent behaviour display.draw(&image); display.draw(image.into_iter());
Trait Implementations
impl<'a, C> IntoIterator for &'a Image16BPP<'a, C> where
C: PixelColor + From<u16>,
[src]
C: PixelColor + From<u16>,