An Interest In:
Web News this Week
- April 23, 2024
- April 22, 2024
- April 21, 2024
- April 20, 2024
- April 19, 2024
- April 18, 2024
- April 17, 2024
Why do the color values range from (0-255) only?
Once upon a time...
Someone asked me this question "Why do the color values range from 0-255 only?".
I was surprised how I never noticed this small thing and began on a quest to know the Truth.
Not Surprisingly, the Truth is so simple.
The Truth
Most of the screens use 24 bits RGB pixels, each pixel has three components in order of** Red, Green, Blue** leaving 8 bits for each color component.
Check this RGB calculator here.
The minimum and maximum decimal number that can be represented through 8 bits is 0 and 255.
00000000 (binary) = 0 (decimal)11111111 (binary) = 255 (decimal)
Each pixel component ranges through 256 different shades of their color (RGB), and each number just sets the brightness/contrast of that pixel component resulting in
256 x 256 x 256 = 16777216 possible colors
I hope you learned something new today, open to comments and suggestions.
Thanks for reading the article.
Original Link: https://dev.to/rahulnegi/why-do-the-color-values-range-from-0-255-only-10k8
Dev To
An online community for sharing and discovering great ideas, having debates, and making friendsMore About this Source Visit Dev To