Image Masks - Completely lost

Scott Rossi scott at tactilemedia.com
Thu Dec 29 14:32:27 EST 2005


Recently, Bob Warren wrote:

> In order to complete this thread, I would like to tell you what it was
> that led me up the garden path from beginning to end. This is so that
> other lost souls in the future don't consider suicide.

No need for suicide.  When in doubt, ask. :-)


> The very simple fact, that I have learned the hard way, is that THE
> INITIAL SIZE OF THE OUTPUT IMAGE BOX NEEDS TO BE PRE-SET TO THE EXACT
> SIZE OF THE MASK IMAGE.

This is written about in the mail archives (granted it may not easy to find
but it has been mentioned several times).

In any event, I've been working a lot lately with image/alphaData and with
Ken Ray's help figured out a little function that can create alphaData from
a black and white image.  This "getAlpha" function requires the long ID of a
source image, and though it is slower than simply reading the alphaData of
an existing transparent image (several seconds for a large image), it allows
for the creation of masks where no transparency info is present.

function getAlpha tImg
  put imageData of tImg into tData
  put 1 into N
  repeat for each char V in tData
    if N = 2 or ((N - 2) mod 4 = 0) then \
        put binaryEncode("C",charToNum(V)) after tAlpha
    add 1 to N
  end repeat
  return tAlpha
end getAlpha

Execute the following in your message box to try it:

 go url "http://www.tactilemedia.com/download/getalpha.rev"


Regards,

Scott Rossi
Creative Director
Tactile Media, Multimedia & Design
-----
E: scott at tactilemedia.com
W: http://www.tactilemedia.com




More information about the use-livecode mailing list