View on GitHub

IRAF Community Distribution

IRAF maintained by the community

Home | Installation | Packages | X11IRAF | PyRAF | Forum

wavelength to RGB ???

Sergei O. Naoumov wrote on Jul 07, 1998


Hi!
I was wondering whether anyone did this excercise before: I have a
range of visible wavelengths, say from 3000 to 8000 angstroms, and
I want to express it in terms of RGB numbers to display on a 8 bit
depth screen.

It does not seem like lambda is a simple linear combination of the
red, green and blue because one can have different combinations of
the coefficients to get the same lambda.

Any advice?

Thanks much,
			Sergei

Doug Tody wrote on Jul 07, 1998

> I was wondering whether anyone did this excercise before: I have a
> range of visible wavelengths, say from 3000 to 8000 angstroms, and
> I want to express it in terms of RGB numbers to display on a 8 bit
> depth screen.
> 
> It does not seem like lambda is a simple linear combination of the
> red, green and blue because one can have different combinations of
> the coefficients to get the same lambda.

> Any advice?

Sergei, this sounds like the usual pseudocolor rendering problem encountered
when displaying grayscale data (i.e. a linear range of values) as some
range of RGB color values.  In principle in a case such as you describe
one could try to map a visible wavelength to a color using a physical
color spectrum mapping, but in practice this rarely works well on a
workstation screen for various reasons, and a pseudocolor (nonphysical)
mapping is used instead.  You might want to have a look at some pseudocolor
color tables to see if any will render the data the way you want.  For
example, see the collection of colortables in ximtool/luts in the x11iraf
distribution (this is often installed with ximtool as well).  A separate
copy of this is available as

    ftp://iraf.noao.edu/iraf/x11iraf/imtoolcmap.tar

These are normalized colormaps, you just scale them linearly to fit your
data range.

	- Doug

Last post on Jul 07, 1998