Sign in to follow this  
Followers 0
Taurus99

Coverting RGB -> HLS function

3 posts in this topic

Is there any existing function to convert RGB values to HLS (Hue, Luminosity and Saturation)? or existing script? I want to use GetPixelColor and find out the HLS values for it.

Thanks.

Share this post


Link to post
Share on other sites



Awesome stuff. I made a slight tweak.

Original Code:

;convert to 0-255 ranges

;h [0-360], h,l [0-1]

$l *= 240

$s *= 240

$h = ($h/360)*240

Replacement Code (switch to 255 as max):

;convert to 0-255 ranges

;h [0-360], h,l [0-1]

$l *= 255

$s *= 255

$h = ($h/360)*255

After that change, its perfectly matches the data in MouseZoom which I use:

Larry, where you found the code, is there's a RGB/HSL conversion to CMYB (Cyan Magena Yellow Black) code?

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0