Convert frequency to RGB

Jim Hurley jhurley at infostations.com
Mon Aug 11 19:53:00 EDT 2003


>>
>>Message: 10
>>Date: Mon, 11 Aug 2003 17:20:41 -0600
>>Subject: Re: Convert frequency to RGB
>>From: Dar Scott <dsc at swcp.com>
>>To: use-revolution at lists.runrev.com
>>Reply-To: use-revolution at lists.runrev.com
>>
>>
>>On Monday, August 11, 2003, at 04:43 PM, Jim Hurley wrote:
>>
>>  > I think I have found what I need. I had hoped I could find an
>>  > algebraic formula for the translation from wavelength to rgb values. I
>>  > did a Google search and found the following program; I will see if I
>>  > can translate it into Transcript.
>>  >
>>That should translate OK.  As with yours, it changes only red, green or
>>blue at a time, and thus will vary in intensity in ways not intended.
>>The blue-purple looks like it goes too purple to me.  The function does
>>attempt to put an envelope over the whole thing that is probably
>>related to sun intensity and eye response.
>>
>>See how it looks.
>>
>>Dar Scott
>>
>
>Dar,
>
>Not very well. Still a bit jerky--in the literal sense. I may have 
>to work on this for a while. I've seen some very nice graphics, I 
>think it was in a web page construction application which had a 
>rainbow-line as a demarker between sections.
>
>I wonder if an image like this could be imported into RR and 
>deciphered  the RGB values from the image by running the wand (from 
>the 1.1.1 color palette) over it and somehow extract this data.
>


Or better still. Get a good smooth rainbow image and run the following handler:

on mouseUP
   put "" into field 1
   get the imageData of image "myImage"
   put the number of chars in it into tNum

   repeat with i = 0 to tNum/4
     repeat with j = 2 to 4
       put chartonum(char(4*i + j)of the  imageData of image 
"myImage") into item j-1 of tLine
     end repeat
     put tLine into line i of results --This gives the three RGB 
numbers for each pixel.
   end repeat

   put results into field 1
end mouseUP


Jim



More information about the use-livecode mailing list