RGB to HSL and back

Thijs Koerselman's icon

I'm looking for a simple external which converts an rgb value to hsl and
back just like the jitter objects, but for one value instead of a matrix. If
it doesn't exist I'll write one myself, but I have a feeling its out there
somewhere...

Thijs

jasch's icon

hsv2rgb - color space conversion (circular swatch)

www.maxobjects.com could have told you,
it lists 5 options out of which mine is the only one ported to windows.

/*j

Thijs Koerselman's icon

thanks Jasch,

I think I better get some sleep. I already checked hsv2rgb, because I use
your library pretty often, but somehow my mind returned "hsv != hsl" doh!

best, t_

Joost Rekveld's icon

but you're mind is right: hsv and hsl are NOT the same, or am I getting
completely confused here ?

if char is ok the easy way to do all kinds of conversions is to fill a
matrix of one value, use jit.colorspace and use [jit.iter] to get your
output...

ciao,

Joost.

-------------------------------------------

Joost Rekveld
----------- http://www.lumen.nu/rekveld

-------------------------------------------

"The mystery of the world is the visible, not the invisible"
(Oscar Wilde)

-------------------------------------------

Thijs Koerselman's icon

Ah all this color stuff is new to me... I was just now getting confused by
the fact that I can't use the hsv "v" value to go from black to white, like
you can with hsl, which is what I'm looking for. That explains it. I'll try
your solution. Thanks.

Thijs