rgb values to 0 to 1 scale

el.severo picture el.severo · Jun 1, 2012 · Viewed 80.6k times · Source

I'm trying to calculate some RGB colors (0 - 255) for a 0 to 1 scale. Does anyone knows a online converter or it exists a math formula?

Lets say that I want to convert 125 RGB with (0 to 255 scale) to a 0 to 1 scale.

Answer

Widor picture Widor · Jun 1, 2012

It's simply a case of dividing your RGB value, call it x by 255:

If x = 95 then your value is 95/255 = 0.373 (to 3 d.p.)