Crazy imageData

Dar Scott dsc at swcp.com
Mon Jun 21 15:34:57 EDT 2004


On Jun 21, 2004, at 11:50 AM, Troy Rollins wrote:

> PUT the imageData of image ID 1018 of stack "Button Icons" into 
> tClearImage
>     set the imageData of image "ThumbNail" of card tClipSelected of 
> stack "CurrentP" to tClearImage
>
> *Sometimes* this will work a hundred times in a row. Then, it will 
> suddenly fail, and fail every time after that.
>
> A little more info -
> image ID 1018 of stack "Button Icons" is an imported JPG, but I've 
> tried PNG, and GIF with the same results.
> When it fails, the image is pure black.
> "Button Icons" is a substack of my main app.
> "CurrentP" is a  mainstack, loaded by my main app as a resource.

I have a couple ideas, but I'm a little confused about something.

You say you import image ID 1018.  When it fails it is pure black?  Do 
you mean image ID 1018?  Then what does image "ThumbNail" have to do 
with it?

When setting the imageData, the height and width must match the 
original.  (Strictly, the size of the imageData must fit the product of 
the height and width.)  I usually clear the destination image (put 
empty into the text of image "ThumbNail") and set the height and width, 
first.  This will reset the alphaData/maskData, too.  I also clear 
before setting the filename property in some situations.

There have been a few imageData and general image bugs that have been 
resolved lately.  You might want to look at Bugzilla.  Some were fixed 
for 2.2 and some fixes will be in an upcoming release.

I have suspected that Revolution will choke on some unusual variations 
of data formats, but since you are seeing this in several formats, that 
probably does not apply to your problem.  Obviously, if I good evidence 
that there are some problems with some format variations I would have 
bugzilla'd this, so take this for what it is worth.

When you dump in your troubleshooting, be sure and include height/width 
and formattedHeight/formattedWidth.  Also alphaData (and maybe 
maskData).  You can also save the image itself.  And you can export the 
image to whatever form you want, including the human readable PBM.

Dar Scott



More information about the use-livecode mailing list