python - Simplest way of converting RGB to Saturation -


i'm totally inexperienced python or programming language, i'm couple days programming , want convert rgb values saturation, have no experience @ programming, keep code simple, i'm using program called cinema 4d python in thing called "xpresso", have plugged in red green , blue values through "xpresso" python don't need define them myself [here link screenshot of i'm doing http://www.4shared.com/download/5uwpm-uece/bandicam_2014-09-10_21-36-26-1.png?lgfp=3000 ], thing need convert values saturation, might unclear question, or wrong place ask question on i'm going ask anyway, simplest way convert rgb saturation value python

if want calculate "by hand":

def main():     global output     output = rgb_to_s(red, green, blue)  def rgb_to_s(r, g, b):     # if have 0-255 rgb values:     r = float(r)/255     g = float(g)/255     b = float(b)/255      cmax = max(r, g, b)     cmin = min(r, g, b)     l = (cmax + cmin)/2     d = cmax - cmin      return d/(1-abs(2*l - 1)) 

Comments

Popular posts from this blog

javascript - how to protect a flash video from refresh? -

android - Associate same looper with different threads -

visual studio 2010 - Connect to informix database windows form application -