3-color (Black/White/Yellow) e-paper dithering
Three-color panels with yellow show black, white and yellow. Yellow is light, so it works well for highlights, skin tones and warm backgrounds when mixed with black dots.
Palette and color codes
The code is the value DitherInk writes for each pixel in .bin, .h, .png and .bmp files. The preview color is the brightened color used for matching and on-screen previews. The index color is the pure color stored in the PNG and BMP palette.
| Color | Code | Preview color | Index color (PNG/BMP) |
|---|---|---|---|
| Black | 0 | #19191e | #000000 |
| White | 1 | #ffffff | #ffffff |
| Yellow | 2 | #f5eb28 | #ffff00 |
Frame buffer format
2 planes of 1 bit per pixel (tri_2plane). The black/white plane comes first (1 = not black), followed by the color plane (1 = color). Each plane packs 8 pixels per byte. Rows are stored top to bottom and each row is padded to a whole byte.
Supported sizes
| Size | Resolution | .bin size |
|---|---|---|
| 2.13" | 250×122 | 7,808 bytes (7.6 KB) |
| 7.5" | 800×480 | 96,000 bytes (93.8 KB) |
Convert an image to 3-color (black/white/yellow) →
Tips
Like red panels, yellow panels usually take two buffers: a black and white plane and a yellow plane.
Example code (7.5" 800×480)
Arduino / ESP-IDF with the .h file
#include "my_image.h" // downloaded from DitherInk
// MY_IMAGE_WIDTH x MY_IMAGE_HEIGHT = 800 x 480, tri_2plane
// Color codes: black=0, white=1, yellow=2
// The buffer is already in the panel's native orientation.
void showImage() {
// With "Split planes" enabled you get two arrays:
epd_write_planes(my_image_black, my_image_color, MY_IMAGE_PLANE_SIZE);
epd_refresh();
}Replace epd_write_frame and epd_refresh with the functions your display driver provides. Most drivers have a function that takes a full frame buffer.
ESP32 loading the .bin file from flash
#include <LittleFS.h>
constexpr size_t FRAME_BYTES = 96000;
static uint8_t frame[FRAME_BYTES];
bool loadFrame(const char* path) {
File f = LittleFS.open(path, "r");
if (!f || f.size() != FRAME_BYTES) return false; // wrong size = wrong panel settings
f.read(frame, FRAME_BYTES);
f.close();
return true;
}Python (Raspberry Pi) reading the .bin file
import numpy as np
data = np.fromfile("my_image.bin", dtype=np.uint8)
assert data.size == 96000
plane = data.size // 2
not_black = np.unpackbits(data[:plane]).reshape(480, -1)[:, :800] # 1 = white or color
is_color = np.unpackbits(data[plane:]).reshape(480, -1)[:, :800] # 1 = color