embedded-mono-img

Crates.ioembedded-mono-img
lib.rsembedded-mono-img
version
sourcesrc
created_at2025-03-20 00:03:20.636262+00
updated_at2025-03-22 13:03:53.229241+00
descriptionConvert .png images to raw binary for embedded_graphics
homepage
repositoryhttps://github.com/kpcyrd/embedded-mono-img
max_upload_size
id1598733
Cargo.toml error:TOML parse error at line 18, column 1 | 18 | autolib = false | ^^^^^^^ unknown field `autolib`, expected one of `name`, `version`, `edition`, `authors`, `description`, `readme`, `license`, `repository`, `homepage`, `documentation`, `build`, `resolver`, `links`, `default-run`, `default_dash_run`, `rust-version`, `rust_dash_version`, `rust_version`, `license-file`, `license_dash_file`, `license_file`, `licenseFile`, `license_capital_file`, `forced-target`, `forced_dash_target`, `autobins`, `autotests`, `autoexamples`, `autobenches`, `publish`, `metadata`, `keywords`, `categories`, `exclude`, `include`
size0
(kpcyrd)

documentation

README

embedded-mono-img

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.

Usage

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.

Alternative solutions

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.

License

MIT OR Apache-2.0

Commit count: 0

cargo fmt