Display Converter

Turns pictures, icons, animations and fonts into the bytes a small display needs, as C array or MicroPython: monochrome OLEDs and LCDs (SSD1306, SH1106, PCD8544), greyscale OLEDs (SSD1327, SSD1322), colour TFTs (ST7735, ST7789, ILI9341) and e-paper. Fonts also as Adafruit GFX font. Everything stays in your browser.

Preview

Monochrome: click or drag on the preview to set or clear single pixels.

Code

Good to know

  • SSD1306, SH1106, SSD1309, ST7565, PCD8544: monochrome with vertical bytes: each byte is 8 pixels of a column, bit 0 at the top, and the picture is sent page by page (8 rows at a time). The SH1106 has 132 columns in memory; the 128 visible ones usually start at column 2.
  • Adafruit GFX and u8g2: drawBitmap() takes horizontal bytes with bit 7 at the left, drawXBMP() horizontal bytes with bit 0 at the left.
  • Colour TFTs (ST7735, ST7789, ILI9341) take RGB565 with the high byte first. As 16-bit words, the values are written so that they lie in that order in the memory of a little-endian controller and can be sent byte by byte.
  • Greyscale OLEDs: SSD1327 and SSD1322 take 4 bits per pixel, two pixels per byte, the left one in the high nibble.
  • Dithering spreads the error of each pixel to its neighbours (Floyd–Steinberg, Atkinson, Sierra) or adds a fixed pattern (Bayer), so photos keep their shades with few colours. For icons and line art, use none and set the threshold.
  • Frames: several pictures, the tiles of a sprite sheet or the frames of an animated GIF become one array with one row per frame. Animated GIFs need Chrome or Edge (ImageDecoder).
  • Fixed-width fonts store every character in a cell of the same size, as many of the small OLED libraries do (5 or 6 × 8 pixels, vertical bytes). Adafruit GFX fonts are proportional: a bitmap for each character plus a table of sizes and offsets, for setFont().
  • Fonts: installed fonts, or TTF, OTF and WOFF files. Mind the licence of a font before you put it into firmware.