how many color combinations in a 24 bit image

本秂侑毒 提交于 2019-12-12 13:07:43

问题


I am reading a book and I am not sure if its a mistake or I am misunderstanding the quote. It reads...

Nowadays every PC you can buy has hardware that can render images with at least 16.7 million individual colors. Rather than have an array with thousands of color entries, the images instead contain explicit color values for each pixel. A 24-bit display, of course, uses 24 bits, or 3 bytes per pixel, for color information. This gives 1 byte, or 256 distinct values each, for red, green, and blue. This is generally called true color, because 256^3 (16.7 million)

He says 1 byte is equal to 256 distinct values. 1 byte = 8 bits. 8^2 bits = 64 combinations of colors right ?? It's not adding up right to me. I know it might be something simple to understand, but I don't understand.


回答1:


The combinations of 8 bits is not 82 (64) but 28 (256). This is because each of the 8 bits can have 2 distinct values. For 1 bit that would give you 2 (21) possibilities, for 2 bits 2*2 (22), for 3 bits 2*2*2 (23)... etc. 3 bytes = 24 bits => 224 = 16.7M possible combinations.




回答2:


1 byte = 8 bits = 2^8 = 256 combinations :)

24 bit combinations = 2^24 = Three 8 bit colors = 256^3 = 16777216 ~= 16.7 million color combinations



回答3:


If you have 24 bits for the color information you can display 2^24 colors = 16.7 million!



来源:https://stackoverflow.com/questions/2892303/how-many-color-combinations-in-a-24-bit-image

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!