Starting at square one with image processing
James Hurley
jhurley0305 at sbcglobal.net
Fri Jul 6 19:51:56 EDT 2007
I've discovered that I have no idea what's going on with the
imagedata function.
I thought that the imagedata was a pixel by pixel map of the image. I
tried the following handler to look at each pixel of my image:
on mouseUp
put the name of image id 1014 into tName
put the imagedata of tName into tData
set the savedImageData of tName to tData
--put the imagedata of img "basic.png" into tData
put 0 into tCounter
repeat for each char tChar in tData
put charToNum(tChar) into tNum
if tCounter mod 4 is 0 then put cr after results
put tNum&comma after results
add 1 to tCounter
end repeat
put results into field 1
end mouseUp
And I got the following in field 1:
0,156,0,2,
0,156,0,2,
0,156,0,2,
0,156,0,2,
0,156,0,2,
0,156,0,2,
0,156,0,2,
0,156,0,2,
0,156,0,2,
0,156,0,2,
0,156,0,2,
0,156,0,2,
0,156,0,2,
etc.
This was the imagedata of a short red line segment painted with the
red pencil.
I thought each line above represented successive pixels across the
image--left to right and top to bottom.
Not so.
This is really screwy. If I set the imagedata of my image to the
imagedata of itself, it is transformed from a short red line to a
solid red square. Actually that is what I would have thought the
column above represented.
You image people out there live in a different world. I'm sure I'll
get this in time, but right now I see that I was living in a fools
paradise when working with graphics objects.
Jim Hurley
More information about the use-livecode
mailing list