have to tune it as it is too dark, even with the most correct translation function you provided
int r = (lsb >> 3) & 0x1F;int g = ((lsb & 0x07) << 3) | ((msb >> 5) & 0x07) ;int b = (msb & 0x1f);r = r << 3; // as r is only 5 bit we must shift it to the left 3 positionsg = g << 2; // g has 6 bitsb = b << 3; // ....and now gray = (r + g + b )/3; or the more sophisticated formulas.// and for some fun you could add some noise which will have a smoothing effect.r = r << 3 + random(8); // fills up the 3 zero bits with some noiseg = g << 2 + random(4);b = b << 3 + random(8);
r = r << 3; // as r is only 5 bit we must shift it to the left 3 positionsg = g << 2; // g has 6 bitsb = b << 3; // ....
r = r << 2;g = g << 1;b = b << 2;
I get an image with many black areas
I am surprised how well only taking the green chanel works. Almost no visible difference to the calculated values.