A simple Python script that converts .png file(s) into a hardcoded array(s) that Arduino monochrome monitors can load and use. Designed to be used with the SSD1306 monochrome display, but naturally probably can be used for other monochrome displays.
To use:
Change the last line of convertToBinary.py to the names of the .png files you want to convert.
convertToBinary(['test01.png','test02.png','test03.png','test04.png'])
The output will be written to a new file called HARDCODED_IMAGE.txt
EXAMPLE:
Will be written into HARDCODED_IMAGE.txt as:
#define TEST02_WIDTH 48
#define TEST02_HEIGHT 16
static const unsigned char PROGMEM test02[] =
{ B00000000, B00000000, B00000000, B00000000, B00000000, B00000000,
B00000000, B00000000, B00000000, B00000000, B00000000, B00000000,
B00000000, B00000000, B00000000, B00111111, B11111000, B01100000,
B00000000, B00000000, B00000000, B01000000, B00000101, B10010000,
B00000011, B11110000, B00000000, B10000000, B00000010, B01001000,
B00000100, B00001000, B00000001, B00011111, B11110000, B00000100,
B00001000, B00000100, B00000010, B00100000, B00001000, B00000100,
B00010001, B11100011, B11111100, B01000000, B00000111, B00111000,
B01100010, B00010000, B00000000, B10000000, B00000000, B11110000,
B10000100, B00001000, B00000001, B00000000, B00000000, B00000000,
B01111000, B00000111, B11111110, B00000000, B00000000, B00000000,
B00000000, B00000000, B00000000, B00000000, B00000000, B00000000,
B00000000, B00000000, B00000000, B00000000, B00000000, B00000000,
B00000000, B00000000, B00000000, B00000000, B00000000, B00000000,
B00000000, B00000000, B00000000, B00000000, B00000000, B00000000,
B00000000, B00000000, B00000000, B00000000, B00000000, B00000000};
