We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexProgramming Questions & HelpSyntax Questions › convert RGB to HSB in a range
Page Index Toggle Pages: 1
convert RGB to HSB in a range (Read 1277 times)
convert RGB to HSB in a range
Jan 27th, 2010, 9:31am
 
I am using HSB colormode but the values are in the range of 0-100 instead of 0-1.

How can I convert RGB values in the range of 0-255 to HSB values?

I can use the Java function Color.RGBtoHSB but I am not clear what range of values it converts to?
Re: convert RGB to HSB in a range
Reply #1 - Jan 27th, 2010, 9:54am
 
Yes, RGBtoHSB method isn't very well documented, you will find some elements of answer in the sibling function HSBtoRGB: "The saturation and brightness components should be floating-point values between zero and one (numbers in the range 0.0-1.0). The hue component can be any floating-point number. The floor of this number is subtracted from it to create a fraction between 0 and 1. This fractional number is then multiplied by 360 to produce the hue angle in the HSB color model."
Page Index Toggle Pages: 1