Dither images for e-paper displays
In this post I will explain how I created the dithered images I use on black and white displays, as shown below:
Backround info: http://www.imagemagick.org/Usage/quantize/
The final step is to create the array of bits:
convert original.jpg \\
-set colorspace Gray -separate -average \\
-ordered-dither h4x4a \\
-thumbnail 264x176^ -gravity center -extent 264x176 \\
original_dither_h4x4a_crop.xbm
Resulting original_dither_h4x4a_crop.xbm
:
#define original_dither_h4x4a_crop_width 264
#define original_dither_h4x4a_crop_height 176
static char original_dither_h4x4a_crop_bits[] = {
0x11, 0x71, 0x66, 0x66, 0x66, 0xE6, 0xCC, 0xCC, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0xDE,
0xDD, 0xDD, 0xD9, 0x99, 0x99, 0x99, 0x39, 0x33, 0x33, 0x00, 0x80, 0x99,
// truncated 477 lines
0xFF, 0x7F, 0x7F, 0xFF, 0xFD, 0xBB, 0xBB, 0xBB, 0x3F, 0x33, 0x77, 0x77,
0x03, 0x00, 0x00, 0x00, 0x62, 0xEC, 0xFF, 0xFF, 0xFF, 0xFF, 0xBF, 0xBB,
0xBB, 0x7B, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
};