I have 2 images $main and $cutout_holes. $main is just any image while $cutout_holes is a black and white image that I want to use as a mask, cutting some holes in $main. I want all white (#ffffff) pixels of $cutout_holes to cut out fully transparent holes in $main. The below is what I have tried so far but it does not work at all.
Any suggestions are welcome
<?
$image = new Imagick();
$image->newImage(100, 100, new ImagickPixel("#222222"));
$image->compositeImage($main, Imagick::COMPOSITE_DEFAULT, 0, 0);
$image->compositeImage($cutout_holes, Imagick::COMPOSITE_DSTIN, 0, 0, Imagick::CHANNEL_ALPHA);
header('Content-type: image/png');
$image->setImageFormat('png');
echo $image;
?>