Convert Color 32bit to 16bit

Status
Not open for further replies.

aadipa

Padawan
32 bit colors are RGBA values each channel taking 8 bits
R - Red
G - Green
B - Blue
A - alpha

16 bit colors are RGB with 5 bits for each, or sometimes 6 bits for green, and 5 for Red and Blue each. More bits to green is because human eye can see more shades of green.

For converting a color from 32 to to 16 bit, each 8 bit color value must be scaled to proper 5 bit color value.

ie Red in 16-bit = Red in 32-bit * 2^5 / 2^8
ie Red in 16-bit = Red in 32-bit / 8

Hope this is what you wanted.
 
OP
R

rajesh_nk22

Journeyman
Sorry, for not posting question in details.
I have developed application in VB, which reads color values on screen using getpixel api, so whenever I use this api, I get different color values depending upon display properties set on my computer. If I change color quality from 32 bit(default where my application works) to 16 bit or 256 bit color value changes. To solve this problem, I want a function to convert 32bit color value to 16bit value.
 
Status
Not open for further replies.
Top Bottom