As mask already has alpha, use it.
Code: Select all
composite Mask.rgb Alpha.rgb -compose Dst_In alpha_masked.rgb
see IM Examples, Alpha Composition for more details.
http://www.cit.gu.edu.au/~anthony/graph ... ose/#dstin
You do not need to extract and mathematically merge the masks.