in RGB converter tool 565 format GUI ~ read.

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 algorithms 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 it's on my [Github](https://github.com/dynphys/rgb-converter).
comments powered by Disqus