The RGB color model is a additive system in which each color was defined by the amount of red, green, and blue light Emitt Ed. In the RGB scheme, colors is represented numerically with a set of three numbers, each of which ranges from 0 to 255. White had the highest RGB value of (255, 255, 255) while Black had the lowest value of (0, 0, 0). This are consistent with the additive nature of the RGB system, since white light are the presence of all colors of light, a nd black is the absense of any light.
There is other three-parameter representations of colors. One such system is the HSI-color model, which encodes colors according to theirHUeSAturation, andINtensity. The HSI model is used by some graphics programs and color monitors as a alternative to, or alongside the RGB Representati On.
In the HSI system, the hue of a color is it angle measure on a color wheel. Pure red hues is 0°, pure green hues is 120°, and pure blues is 240°. (Neutral Colors--white, Gray, and Black--are set to 0°for convenience.) Intensity is the overall lightness or brightness of the color, defined numerically as the average of the equivalent RGB VA Lues.
The HSI definition of saturation is a measure of a color ' s purity/grayness. Purer colors has a saturation value closer to 1, while grayer colors has a saturation value closer to 0. (In other color models, the meanings and mathematical definitions of "saturation" is slightly different. See HSL and HSV color models for comparison.)
Equations to Convert RGB values to HSI values
Suppose R, G, and B are the red, green, and blue values of a color. The HSI intensity is given by the equation
I = (R + G + B)/3.
Now let M is the minimum value among R, G, and B. The HSI saturation value of a color is given by the equation
S = 1-m/i If I > 0, or
S = 0 if I = 0.
To convert a color ' s overall hue, H, to an angle measure, use the following equations:
H = cos-1[(R-½g-½b)/√r²+ g²+ b²-RG-RB-GB] if g≥b, or
H = 360-cos-1[(R-½g-½b)/√r²+ g²+ b²-RG-RB-GB] If B > G,
Where the inverse cosine output is in degrees.
Equations to Convert HSI values to RGB values
To convert hue, saturation, and intensity to a set of red, green, and blue values, you must first note the value of H. If H = 0, then R, G, and B is given by
R = I + 2IS
G = I-is
B = I-is.
If 0 < H <, then
R = I + is*cos (H)/cos (60-h)
G = I + is*[1-cos (H)/cos (60-h)]
B = I-is.
If H = +, then the red, green, and blue values is
R = I-is
G = I + 2IS
B = I-is.
If < H <, then
R = I-is
G = I + is*cos (H-120)/cos (180-h)
B = I + is*[1-cos (H-120)/cos (180-h)].
If H =
R = I-is
G = I-is
B = I + 2IS.
And if < H <, we have
R = I + is*[1-cos (H-240)/cos (300-h)]
G = I-is
B = I + is*cos (H-240)/cos (300-h).
RGB to HSI, HSI to RGB Conversion Calculator