Description
I want to write a tool for converting png to LV_IMG_CF_TRUE_COLOR_ALPHA ,like an online converter.
First I read every pixel of the picture, and then I converted those pixels to TRUE_COLOR_ALPHA format. I compare my tools to the results of online conversions, and they are not the same.
For example, RGB(88, 33, 44)
, the online tool’s conversion result is: 0x06, 0x59
, and my tool’s conversion result is: 0x5, 0x59
.
What MCU/Processor/Board and compiler are you using?
x86
What LVGL version are you using?
lvgl8.3
What do you want to achieve?
I just want to know, how does the online converter convert rgb888 to rgb565?
What have you tried so far?
Code to reproduce
Here is my conversion code
static UInt16 BRGA2RGB565(byte b, byte g, byte r, byte a = 0xFF)
{
int ir = r >> 3;
int ig = g >> 2;
int ib = b >> 3;
int v = ib;
v |= ig << 5;
v |= ir << 11;
return (UInt16)v;
}