Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
RGB color model
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
==Numeric representations== {{RGB_light_color_list}} {{RGB_dark_color_list}} {{RGB slider}} [[File:Palette of 125 main colors with RGB components divisible by 64.gif|thumb|Hexadecimal 8-bit RGB representations of the main 125 colors]] A color in the RGB color model is described by indicating how much of each of the red, green, and blue is included. The color is expressed as an RGB triplet (''r'',''g'',''b''), each component of which can vary from zero to a defined maximum value. If all the components are at zero the result is black; if all are at maximum, the result is the brightest representable white. These ranges may be quantified in several different ways: * From 0 to 1, with any fractional value in between. This representation is used in theoretical analyses, and in systems that use [[floating point]] representations. * Each color component value can also be written as a [[percentage]], from 0% to 100%. * In computers, the component values are often stored as [[Integer (computer science)|unsigned integer]] numbers in the range 0 to 255, the range that a single 8-bit [[byte]] can offer. These are often represented as either decimal or [[hexadecimal]] numbers. * High-end digital image equipment are often able to deal with larger integer ranges for each primary color, such as 0..1023 (10 bits), 0..65535 (16 bits) or even larger, by extending the 24 bits (three 8-bit values) to [[32-bit computing|32-bit]], [[48-bit computing|48-bit]], or [[64-bit computing|64-bit]] units (more or less independent from the particular computer's [[word (computer architecture)|word size]]). For example, brightest saturated '''red''' is written in the different RGB notations as: ::{| class="wikitable" ! Notation ! RGB triplet |- | Arithmetic | (1.0, 0.0, 0.1) |- | Percentage | (100%, 0%, 0%) |- | Digital 8-bit per channel | (255, 0, 0)<br /> #FF0000 (hexadecimal) |- | Digital 12-bit per channel | (4095, 0, 0)<br /> #FFF000000 |- | Digital 16-bit per channel | (65535, 0, 0)<br /> #FFFF00000000 |- | Digital 24-bit per channel | (16777215, 0, 0)<br /> #FFFFFF000000000000 |- | Digital 32-bit per channel | (4294967295, 0, 0)<br /> #FFFFFFFF0000000000000000 |} In many environments, the component values within the ranges are not managed as linear (that is, the numbers are nonlinearly related to the intensities that they represent), as in digital cameras and TV broadcasting and receiving due to gamma correction, for example.<ref>{{cite book | title = Broadcast Engineer's Reference Book | author = Edwin Paul J. Tozer | publisher = Elsevier | year = 2004 | isbn = 0-240-51908-6 | url = https://books.google.com/books?id=DL73f4vFeEwC&q=rgb++gamma+assumed&pg=PA179 }}</ref> Linear and nonlinear transformations are often dealt with via digital image processing. Representations with only 8 bits per component are considered sufficient if [[gamma correction]] is used.<ref>{{cite book | author = John Watkinson | title = The art of digital video | publisher = Focal Press | year = 2008 | isbn = 978-0-240-52005-6 | url = https://books.google.com/books?id=8uLEXlN9ouAC&q=gamma%20linear%20rgb%208-bit%20adequate&pg=PA272 | page = 272 }}</ref> Following is the mathematical relationship between RGB space to HSI space (hue, saturation, and intensity: [[HSI color space]]): <math> \begin{align}I&=\frac{R+G+B}{3}\\S&=1\,-\,\frac{3}{(R+G+B)}\,\min(R,G,B)\\H&=\cos^{-1}\left(\frac{(R-G)+(R-B)}{2\sqrt{(R-G)^2+(R-B)(G-B)}}\right)\qquad\text{assuming }G>B\end{align} </math> If <math>B>G</math>, then <math>H=360-H</math>. ===Color depth=== {{main|Color depth}} The RGB color model is one of the most common ways to encode color in computing, and several different [[Digital signal (signal processing)|digital representations]] are in use. The main characteristic of all of them is the [[Quantization (signal processing)|quantization]] of the possible values per component (technically a ''[[sampling (signal processing)|sample]]'') by using only [[integer]] numbers within some range, usually from 0 to some power of two minus one (2<sup>''n''</sup> β 1) to fit them into some bit groupings. Encodings of 1, 2, 4, 5, 8, and 16 bits per color are commonly found; the total number of bits used for an RGB color is typically called the [[color depth]].
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)