Convert frequency to RGB

Dar Scott dsc at swcp.com
Mon Aug 11 18:57:01 EDT 2003


On Monday, August 11, 2003, at 05:10 PM, Monte Goulding wrote:

> Ideally if it were to be in libColor I'd like a WavelengthToRGB 
> function and
> an RGBToWavelength function.

In general, you can't do an RGBToWavelength.

Wavelength is 1D and color without brightness is 2D.  RGB is 3D.  We 
see a rich range of colors by a mix of more than one wavelength of 
various intensities.  A large part of that space we see can be 
replicated by the right mix of red, green and blue phosphors (each of 
which is really a mix of several wavelengths, muddying colors a tiny 
bit, but looking great anyway).

As for WavelengthToRGB, the CEI tables convert to non-real RGB-like 
values that are related to physiological and psychological response.  
This could be handy.  However, these are not the same as the typical 
phosphors including those defined for monitors, such as VGA.  Those 
colors are inside the space of observable colors and form a triangle of 
possible RGB colors.  The wavelengths run along the periphery of 
observable colors--outside of that triangle.  That means all 
wavelengthToRGB calculations must be compromises.  The colors are 
_always_ wrong.  One model for compromising is to select the best color 
along the edge of the RGB color triangle.  Then you have the problem of 
what best means.  I like the idea of where a line from white to the 
desired color crosses the boundary of the RGB color triangle.  However, 
I suspect there is probably a better way to do this by whitening all 
colors, that is by shrinking the CEI color horseshoe into the RGB 
triangle.  The psychologists can say better than I.  All this to say 
that a WavelengthToRGB function can be handy and valuable, but must 
either be spec'd carefully or described as approximate.  The one that 
Jim is tinkering with is definitely the later, but might be useful to 
him and to others.

Dar Scott






More information about the use-livecode mailing list