pythonimage-processingraspberry-piditheringe-ink

Convert full color image to three color image for e-ink display


I'd like to be able to automagically convert full color images down to three color (black / red / white) for an e-ink display (Waveshare 7.5"). Right now I'm just letting the screen handle it, but as expected complex images get washed out.

Are there any algorithms or filters I could apply to make things a bit more visible?

Right now I'm using Python, but I'm not averse to other languages/environments if necessary.

Good image:

Good image

Washed out image:

washed out


Solution

  • You could make your own palette of 3 acceptable colours like this:

    magick xc:red xc:white xc:black +append palette.gif
    

    Then you can apply it to your image like this:

    magick input.png +dither -remap palette.gif result.png
    

    enter image description here

    If you want to send it straight to the frame buffer and it supports RB888, you can try running something like this:

    magick input.png +dither -remap palette.gif -depth 8 RGB:/dev/fb0