Page 1 of 1
Mask & Alpha
Posted: Tue Jan 18, 2011 12:41 am
by jeanvouillon
Hi guys,
I would like to 'clip' an image imported from the library.
So I'm playing with the alphaData and maskData instructions...
I have tried something simple by copying the alpha channel from an image to the binary data:
put the alphaData of image "mask" into myMask
set the alphaData of image "masked" to myMask
but nothing happen to the image.
Am I missing something?
Thanks.
Re: Mask & Alpha
Posted: Tue Jan 18, 2011 1:20 am
by bn
Hi Jean,
for something to happen the image has to have alpha information. Otherwise the alphadata is set to transparent. PNG images can have, but must not have alphadata.
Jpeg does not have alphadata.
Very important if you work in imagedata, alphadata or maskdata. Both images have to have the exact same width and height.
I append a stack with an image (an imported png with alphadata) and a image object that I just filled with the bucket tool red.
You can set the alphadata or the maskdata of the red image, you also can remove the alphaData or maskData from the red image via buttons.
Note that the maskdata makes the oval jagged, since the maskdata is only on or off. The alphadata makes a smooth oval, since alphadata is antialiased.
Kind regards
Bernd
Re: Mask & Alpha
Posted: Tue Jan 18, 2011 2:21 am
by jeanvouillon
Hi Bernd,
Thanks for your (ultra fast!) response and your stack.
So, there is no others ways to clip an image?
Thanks again,
Re: Mask & Alpha
Posted: Tue Jan 18, 2011 9:50 am
by bn
Hi Jean,
look at the crop command in the dictionary.
Kind regards
Bernd
Re: Mask & Alpha
Posted: Tue Jan 18, 2011 4:13 pm
by jeanvouillon
Great!
Thanks Bernd!
