I have seen many algorithms and formulas for converting RGB data to HSL but none were successful.
So where can I get few algorithms/formulas for converting.
I have seen many algorithms and formulas for converting RGB data to HSL but none were successful.
So where can I get few algorithms/formulas for converting.
If performance isn't critical, the above link is a good example.
If you need it to be several times faster than a pure C implementation of the above, you can do it with SSE instructions. An example of RGB to HSV is in the ahsv_from_argb_sse2
function at: (EDIT: Updated link)
https://github.com/kobalicek/simdtests/blob/master/rgbhsv/rgbhsv_sse2.cpp
Converting to HSL is not all that much different. You can see the difference in the code at:
http://ariya.blogspot.com/2008/07/converting-between-hsl-and-hsv.html