#bmp #monochrome

bmp-monochrome

Encode and decode monochromatic bitmaps without additional dependencies, useful for QR codes

14 breaking releases

new 0.17.0 Oct 25, 2020
0.15.0 Oct 21, 2020

#25 in Rendering

Download history 190/week @ 2020-09-27 135/week @ 2020-10-04 159/week @ 2020-10-11 199/week @ 2020-10-18

229 downloads per month
Used in 4 crates (2 directly)

MIT license

33KB
762 lines

bmp-monochrome

Encode and decode monochromatic bitmaps without additional dependencies, useful for QR codes.

Example

use bmp_monochrome::Bmp;
use std::error::Error;
use std::fs::File;

fn main() -> Result<(), Box<dyn Error>> {
    let file_name = "test.bmp";
    let width = 21;
    let data: Vec<bool> = (0..width * width).map(|e| e % 2 == 0).collect();
    let bmp = Bmp::new(data, width)?;
    bmp.write(File::create(file_name)?)?;
    let bmp_read = Bmp::read(File::open(file_name)?)?;
    assert_eq!(bmp, bmp_read);
    Ok(())
}

Generates

test

Minimum Supported Rust Version (MSRV)

Rust 1.34

Use u32::try_from introduced in 1.34.0


lib.rs:

BMP monochrome

This library encode and decode monochromatic bitmap with no extra dependencies. Especially useful to encode QR-codes

Dependencies

~0–440KB