source
source copied to clipboard
Add RGB to spectrum functions
It would be useful to have a set of function that generate spectra that correspond to particular sRGB/CIE XYZ values. This will be a useful shorthand way of generating arbitrary colour specta for testing.
Well , I can't give you the exact function because the language may vary , but you can check out my stuff on a python script called Rgb to rainbow.py . It will clearly explain the algorithm of converting between rgb to spectra and vice versa , by making an image of the spectra using rgb values , I think my program will help you . Just search it at my place . All rgb values can't be converted to spectra by the way .