XhCode Online Converter Tools

RGB HSV Converter

  Red(R:0~255) 

Green(G:0~255)

  Blue(B:0~255) 
H S V





RGB to HSV

RGB to HSV refers to the process of converting a color from the RGB (Red, Green, Blue) color model to the HSV (Hue, Saturation, Value) color model.

What is RGB?
RGB stands for Red, Green, and Blue, which are the primary colors used in digital screens (additive color model). The values of each color are usually in the range of 0 to 255.
What is HSV?
HSV stands for Hue, Saturation, and Value, which is a cylindrical color model often used in graphic design and image processing.
Hue represents the color type and is usually expressed as an angle in degrees (0° to 360°).
Saturation measures the intensity or purity of the color, from 0% (gray) to 100% (full color).
Value (or Brightness) represents how light or dark the color is, from 0% (black) to 100% (full brightness).
How to Convert RGB to HSV:
The conversion involves several steps:

Normalize the RGB values:

First, you need to normalize the RGB values from the range of 0–255 to the range of 0–1 by dividing each RGB value by 255:
R' = R / 255, G' = G / 255, B' = B / 255
Find the minimum and maximum RGB values:

Find the max (the highest value of R', G', and B') and the min (the lowest value of R', G', and B').
Calculate the Hue (H):

If max = min (i.e., the color is gray), H = 0.
Otherwise, use the following formulas to calculate H:
If max = R', then H = (60 × ((G' - B') / (max - min)) + 360) % 360.
If max = G', then H = (60 × ((B' - R') / (max - min)) + 120) % 360.
If max = B', then H = (60 × ((R' - G') / (max - min)) + 240) % 360.
Calculate Saturation (S):

If max = 0, then S = 0 (i.e., the color is gray).
Otherwise, S = (max - min) / max.
Calculate Value (V):

V = max.
Convert values to percentages:

You can convert S and V to percentages by multiplying by 100.
Example Conversion:
Let's convert RGB(255, 99, 71) to HSV.

Normalize RGB:

R' = 255 / 255 = 1.0
G' = 99 / 255 ≈ 0.388
B' = 71 / 255 ≈ 0.278
Find max and min:

max = 1.0, min ≈ 0.278
Calculate Hue (H):

Since max = R', use the formula:
H = (60 × ((G' - B') / (max - min)) + 360) % 360
H = (60 × ((0.388 - 0.278) / (1.0 - 0.278)) + 360) % 360 ≈ 9.89° (a reddish-orange hue).
Calculate Saturation (S):

S = (max - min) / max = (1.0 - 0.278) / 1.0 ≈ 0.722, or 72.2%.
Calculate Value (V):

V = max = 1.0, or 100%.
Final HSV:
So, the HSV equivalent of RGB(255, 99, 71) is:

H ≈ 9.89° (reddish-orange hue)
S ≈ 72.2% (saturated color)
V = 100% (full brightness)
In Summary:
The RGB to HSV conversion is useful when you want to work with colors in terms of hue, saturation, and brightness instead of the additive RGB values. The HSV model is often more intuitive for color selection and manipulation, especially for tasks like color adjustments and graphic design.

TOP