Hello to all! I'm trying to create a simple mask superimposed on an image using the PHP Image Magick library. I created two images: the usual white square on a transparent background and I took a regular jpg file with a regular texture. Next, I applied the following code ...
<?php $image = new Imagick($_SERVER['DOCUMENT_ROOT'].'/imagemagic/image/bg.jpg'); $mask = new Imagick($_SERVER['DOCUMENT_ROOT'].'/imagemagic/image/mask_1.png'); $width = $mask->getImageWidth(); $height = $mask->getImageHeight(); $image->resizeImage($width, $height, Imagick::FILTER_LANCZOS, 1); $image->compositeImage($mask, Imagick::COMPOSITE_DSTIN, 0, 0); header('Content-type: image/png'); echo $image; ?>
As a result, the image was cut out, but as I wanted, but for some reason the background turned black. And the question is how to make the background transparent?