We are running a server with imagemagick 6.7.x
I was trying to upgrade to the latest versions of imagemagick.
But from 6.8.x and higher we have some serious issues with masking, see my screenshot:

We are using imagick (php) and the function:
$png->compositeImage($mask, Imagick::COMPOSITE_DSTIN, round($maskx), round($masky));