Your Web News in One Place

Help Webnuz

Referal links:

Sign up for GreenGeeks web hosting
January 12, 2022 04:40 pm GMT

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.

Screenshot (40).png
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

Share this article:    Share on Facebook
View Full Article

Dev To

An online community for sharing and discovering great ideas, having debates, and making friends

More About this Source Visit Dev To