DitherInk

4-color (Black/White/Yellow/Red) e-paper dithering

Four-color panels show black, white, yellow and red. With both warm colors available, oranges and skin tones can be mixed from red and yellow dots instead of only one accent color.

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.

ColorCodePreview colorIndex color (PNG/BMP)
Black0#19191e#000000
White1#ffffff#ffffff
Yellow2#f5eb28#ffff00
Red3#b92d28#ff0000

Frame buffer format

2 bits per pixel (color_2bpp). 4 pixels per byte, the top two bits are the leftmost pixel. The value is the color code. Rows are stored top to bottom and each row is padded to a whole byte.

Supported sizes

SizeResolution.bin size
2.13"250×1227,686 bytes (7.5 KB)
2.9"296×1289,472 bytes (9.3 KB)

Convert an image to 4-color (black/white/yellow/red) →

Ad

Tips

Four-color panels store each pixel as a 2-bit color code, packed four pixels per byte.

Example code (2.13" 250×122)

Arduino / ESP-IDF with the .h file

#include "my_image.h"  // downloaded from DitherInk

// MY_IMAGE_WIDTH x MY_IMAGE_HEIGHT = 250 x 122, color_2bpp
// Color codes: black=0, white=1, yellow=2, red=3
// The buffer is already in the panel's native orientation.

void showImage() {
  epd_write_frame(my_image, MY_IMAGE_SIZE);  // your driver's full-frame write
  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 = 7686;
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 == 7686
codes = np.stack([(data >> s) & 0b11 for s in (6, 4, 2, 0)], axis=-1).reshape(122, -1)[:, :250]