This is a small utility that reduces the color palette of an image so that it is suitable for an e-ink display. It uses Floyd-Steinberg dithering to produce adequate results.
It supports all of the image format offered by the image crate. The output format is automatically determined by the extension of the output filename.
It is a small, portable, and self-contained application similar to Waveshare's Convertertocolor. The only requirements are Rust and Cargo.
Six color palettes are available:
| Palette | Alias | Description |
|---|---|---|
six-color |
6 |
Spectra E6 palette (this is the default) |
black-white |
bw |
Black and white |
black-white-red |
bwr |
Black, white, and red |
black-white-yellow |
bwy |
Black, white, and yellow |
four-color |
4 |
Black, white, red, and yellow |
n-color |
n |
Black, white, blue, green, orange, red, yellow |
Example:
$ cargo run -p bw input.png output.bmp
The resulting images have been tested on Waveshare's 4" e-Paper HAT+ (E).