Convert RGB to light frequency

18,756

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

Wavelength

And you can convert RGB to HSL, but HSL spectrum looks like

HSL spectrum

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.

Share:
18,756
user1031431
Author by

user1031431

Updated on June 28, 2022

Comments

  • user1031431
    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.

    [1] http://www.fourmilab.ch/documents/specrend/