简体   繁体   中英

Why RGB values are represented as 8-bit integers?

Each RGB value is represented as an 8-bit integer (0-255). Why not store it as a decimal number to increase the color space? It should give more realistic looking picture.

Colours are sometimes represented by three floats instead of as 24 bits.

The 8 bit standard is historical: It goes back to the days of 8 bit architectures. 3 bytes can give the colour of a pixel without wasting any memory and having the same number of bits for each colour component.

This has some advantages: you can write the colour as a 6 digit hexadecimal number and have some idea of what the colour will be:

0xff0000 : Red
0x00ff00 : Green
0x0000ff : Blue

And so on. This is quite compact and efficient and has stuck around, as a colour can be held in a single integer value instead of three floats.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM