| Crates.io | embedded-mono-img |
| lib.rs | embedded-mono-img |
| version | 0.2.0 |
| created_at | 2025-03-20 00:03:20.636262+00 |
| updated_at | 2025-03-22 13:03:53.229241+00 |
| description | Convert .png images to raw binary for embedded_graphics |
| homepage | |
| repository | https://github.com/kpcyrd/embedded-mono-img |
| max_upload_size | |
| id | 1598733 |
| size | 39,755 |
This program is for use with
embedded_graphics to convert a .png
into the data needed/used for ImageRaw::<BinaryColor> during embedded
firmware development with Rust.
embedded-mono-img -o img.raw img.png
const IMAGE: ImageRaw<BinaryColor> = ImageRaw::new(include_bytes!("../img.raw"), 24);
The file is recommended to be in 8-bit Grayscale.
In the past I used imagemagick like this:
convert frame1.png -monochrome -negate frame1.pbm
# use a hex editor, search for start of null bytes
tail -c +11 frame1.pbm > frame1.raw
However the exact offset for the tail command varied depending on the
presence of metadata (like e.g. a comment). This problem has inspired
development of embedded-mono-img so I don't need to worry about this anymore.
MIT OR Apache-2.0