A small BMP parser designed for embedded, no-std environments but usable anywhere. Beyond parsing the image header, no other allocations are made. A reference to the input image data is kept and slices are returned from it.
```rust use tinybmp::{Bmp, Header, FileType};
let bmp = Bmp::frombytes(includebytes!("./my_image.bmp")).expect("Failed to parse image");
// Metadata extracted from image. Assumes myimage.bmp is 8x8px, 24BPP asserteq!( bmp.header, Header { filetype: FileType::BM, filesize: 314, reserved1: 0, reserved2: 0, imagedatastart: 122, bpp: 24, imagewidth: 8, imageheight: 8, } );
let imagedata: &[u8] = bmp.imagedata();
// Render, process or iterate on image_data
here
```
Licensed under either of
at your option.
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.