chipp at chipp.com
Thu Sep 12 15:47:01 EDT 2002
Ken, been looking at you excellent tutorial on imagedata. I'm trying to read
the imagedata from one image, process it and set it to another image.
Currently, I just want to read it into a variable, then convert it to RGB
space, then convert it back and set the second image.
I looked at your document and it says (under Retreiving Image Data):
"So in our 3-pixel image example above (which well call "ThreePixel"), if
answer charToNum(char 6 of the imageData of image "ThreePixel")
... you would get 255 displayed in the Answer dialog, which would correspond
to the Green bit of the second pixel of our image."
it seems to me it would be the 6th character not the 7th, so it would be the
Red not the Green. Am I missing something?
here's what I'm trying to do.It doesn't work -- any help would be
put the imageData of Image1 into timagedata
put 1 into y
repeat with x = 1 to the number of chars in timagedata
--convert to RGB space
put charToNum(char x*y of timagedata) into t0
put charToNum(char x*y + 1 of timagedata) into tR
put charToNum(char x*y + 2 of timagedata) into tG
put charToNum(char x*y + 3 of timagedata) into tB
put y+4 into y
put binaryEncode("CCCC",t0,tR,tG,tB) after tconvData
set the width of img 2 to the width of img 1
set the height of img 2 to the height of img 1
set the imagedata of img 2 to tconvdata
More information about the Use-livecode