Convert RGB to light frequency
Solution 1
AFAIK, there is no direct answer because multiple wavelengths can combine to give the same color right? So you have the wavelengths that map to pure colors and then their combinations can give many other and the same colors. And there are several combinations that can give the same color. This is because of inteference. So you essentially are asking for a one to many mapping.
To answer your question: There is no fixed formula. The reverse formulas will give you a range. That is the best it can get.
Solution 2
Maybe Javascript - Sort rgb values can help you.
But the problem is that the wavelength spectrum looks like
And you can convert RGB to HSL, but HSL spectrum looks like
Then, there are problems because wavelength spectrum doesn't have all colors, such as pink.
I guess that's because pink doesn't exist in the nature, it's a combination of the colors of the opposite extremes of light's spectrum. But we have it in RGB.
user1031431
Updated on June 28, 2022Comments
-
user1031431 over 1 year
Is it possible to obtain the light frequency of a colour from a RGB representation? I've found the opposite process [1] but I don't know if it's possible this way.