How does one convert 16-bit RGB565 to 24-bit RGB888?

后端 未结 8 882
深忆病人
深忆病人 2020-11-27 03:22

I’ve got my hands on a 16-bit rgb565 image (specifically, an Android framebuffer dump), and I would like to convert it to 24-bit rgb888 for viewing on a normal monitor.

8条回答
  •  死守一世寂寞
    2020-11-27 03:57

    The general solution is to treat the numbers as binary fractions - thus, the 6 bit number 63/63 is the same as the 8 bit number 255/255. You can calculate this using floating point math initially, then compute a lookup table, as other posters suggest. This also has the advantage of being more intuitive than bit-bashing solutions. :)

提交回复
热议问题