Thanks Mark and Scott,
the text ... hmm, not the first to think about with an image :)
If it helps, Tiemo, you can use this:
put into image 1
and
if image 1 is empty then...
The text property is implied in the same was as for fields (put field 1
into.. vs. put the text of field 1 into...).
Here's a good way to think about images: there's a distinction between the
actual image binary data and what is used to show the user what the image
currently looks like (including scaling, rotation, rendering in various quality
levels, the paintCompression, etc.). The binary data is the image's
*contents* (the 'text' of the image in this case), and what is shown to the
user is the 'imageData'+'maskData'+'alphaData' (which I'll just call image
data). If you empty out the image data, the binary data still exists - all
you've done is to say (in effect) don't show this image to the user, or more
accurately: show blank to the user.
You can have binary data without image data but not the other way around; once
you set the image data of an image, the binary data is *created* to support the
image data you set. This can be very useful in keeping a scaled version of an
image in a stack without holding on to all the extra weight of the original
image.
So for example, if you imported a 100K image that was 1000 x 1000 pixels and
then scaled it down to 100 x 100 (and set the lockLoc to true so it doesn't
pop back to its original size), the user would see 100 x 100 pixels of image
data, but the image would be storing 1000 x 1000 pixels of binary data.
However, if you created a new blank 100 x 100 image an then executed:
set the imageData of img 2 to the imageData of img 1
set the alphaData of img 2 to the alphaData of img 1
set the maskData of img 2 to the maskData of img 1
the binary data for img 2 would only be what is necessary to support what the
user sees (100 x 100 pixels). It would look exactly like image 1, but would be
only 1% of the original number of pixels and would only take up 1K instead of
100K. You could then delete image 1 and you'd have exactly what you started
with but storing a bunch less space.
This is great for working with thumbnails of full-resolution images; of course
if you *need* to keep the full-res image around because the image might scale
*up* from 100x100 to 1000x1000 (or any size in between) then you want to work
with the full-res image and not make a cheap copy, but you get the idea.
I have a very old (but still mostly accurate) primer on imageData, alphaData,
and maskData here:
http://www.sonsothunder.com/devres/revolution/tips/imag003.htm
Hope this helps,
Ken Ray
Sons of Thunder Software, Inc.
Email: k...@sonsothunder.com
Web Site: http://www.sonsothunder.com/
Thanks for your quick response
Tiemo
-Ursprüngliche Nachricht-
Von: use-livecode-boun...@lists.runrev.com [mailto:use-livecode-
boun...@lists.runrev.com] Im Auftrag von Scott Rossi
Gesendet: Montag, 11. Juli 2011 11:48
An: LiveCode Mail List
Betreff: Re: How to test if an image is empty?
Recently, Tiemo Hollmann TB wrote:
when I put empty into img foo the imagedata of img foo is still not
empty, there are still any binary data in the image.
I can't test if the imagedata of img foo is empty nor can I test if
the
img foo is empty. How can I test if I have put empty into an image?
Can I
test it binary?
To truly empty an image, I set the text property of the image to empty,
and also check that property to make sure it's empty.
return (the text of img 1 is empty)
Regards,
Scott Rossi
Creative Director
Tactile Media, UX Design
___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your
subscription
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode