Images and Image Data
Ken Ray
kray at sonsothunder.com
Thu Jul 4 01:42:01 EDT 2002
Michael,
Check out my "tutorial" on imageData at:
http://www.sonsothunder.com/devres/revolution/revolution.htm
Click on the following links on that page:
imag003 - Understanding ImageData, MaskData and AlphaData
as a start to get a handle on how to manipulate imageData.
What you're going to want to do in your script is:
1) Create an image object with no image in it.
2) Use the binaryEncode() function to create binary values for each pixel of
the image to be created and store it in a variable.
3) Set the imageData of the image object to the variable that contains the
binary.
Here's an example of a script that creates a 20x20 image that is pure blue:
on mouseUp
create image
put it into tID
set the width of tID to 20
set the height of tID to 20
put empty into iData
repeat with i = 1 to 20
repeat with j = 1 to 20
put binaryEncode("CCCC",255,0,0,0) after iData
end repeat
end repeat
set the imageData of tID to iData
end mouseUp
Hope this helps,
Ken Ray
Sons of Thunder Software
Email: kray at sonsothunder.com
Web Site: http://www.sonsothunder.com/
----- Original Message -----
From: "Michael Crawford" <michael.crawford at stonebow.otago.ac.nz>
To: <metacard at lists.runrev.com>
Sent: Wednesday, July 03, 2002 11:46 PM
Subject: Images and Image Data
>
>
> I have a little project in which I want to convert an array of numbers
from
> a text file into an image file. This will be done by making the highest
> number white and the lowest number in the array black. The number in
> between will be assigned a grey value depending on the amount.
>
> For example 100,50,0,50,100 would make an image 1 pixel high and 5 pixels
> across. The end pixels would be white the middle one black and the ones
> either side 50% grey.
>
> Manipulating the numbers is fine but generating the image from those
> numbers is proving problematic. I can see that you should use the
ImageData
> property to do this but how just seems completely beyound me at the
moment.
>
> Does any one have any examples or pointers on how I should go about doing
this?
>
> Thanks
>
> Michael
>
>
> _______________________________________________
> metacard mailing list
> metacard at lists.runrev.com
> http://lists.runrev.com/mailman/listinfo/metacard
>
More information about the metacard
mailing list