Selecting or deleting in an image by color or color range?

Ben Fisher boinjyboing at hotmail.com
Tue Feb 1 18:52:17 EST 2005


Here's something I would use:

(put in the script of the image)
on mouseUp
put the mousecolor into mcolor
put numtochar(0) & numtochar(item 1 of mcolor) into hexcolor
put numtochar(item 2 of mcolor) & numtochar(item 3 of mcolor) after hexcolor

put numtochar(255)&numtochar(255)& numtochar(255)&numtochar(255) into blankcolor

put the imagedata of me into idata
replace hexcolor with blankcolor in idata
set the imagedata of me to idata
end mouseUp

Now isn't that elegant!!

This will turn all the instances of that color white, or at least it should. You'll need to use maskdata if you want to make the areas transparent.
(This script is untested.)

-Ben

>Can an image have a selection by color or color range from within 
>Runtime so as to delete that color or range of colors in the image? It 
>would be like the eraser tool for a color.


More information about the Use-livecode mailing list