November 28, 2015 · RGB converter tool 565 format GUI ·

24-bit / 16-bit color converter tool for embedded LCD GUIs

Image of Yaktocat

I spent some time on coding a small graphical interface on a TFT screen. In short, it's about transmitting pixels coded as 16-bit frames, from the MCU to the graphical controller.

Over time I just got tired of looking for an online service to convert 24-bit color codes to 565 format code and I built this small converter. As the 565 format is actually a palette of the 24-bit format (1 byte of data is lost during the conversion), be aware that each 565 code has several equivalents in the 24-bit format.

Here are the conversion rules for 16-bit to 24-bit...

R8 = (R5 * 527 + 23) >> 6;
G8 = (G6 * 259 + 33) >> 6;
B8 = (B5 * 527 + 23) >> 6;

...and for 24-bit to 16-bit :

R5 = (R8 * 249 + 1014) >> 11;
G6 = (G8 * 253 + 505) >> 10;
B5 = (B8 * 249 + 1014) >> 11;

Simple. Practical. And you can get it here.

  • LinkedIn
  • Tumblr
  • Reddit
  • Google+
  • Pinterest
  • Pocket