在php中使用Imagick将水印作为图像隐藏在图像后面


Watermark as image Behind the Image using Imagick in php

我在php中使用Imagick来显示图像后面的水印(图像),但不能。它在图像的正面显示

我的代码是:-

$watermark = new Imagick();
$watermark->readImage("watermark.png");  
$wWidth = $watermark->getImageWidth();
$wHeight = $watermark->getImageHeight();
$iWidth = $im->getImageWidth();
$iHeight = $im->getImageHeight();
 if ($iHeight < $wHeight || $iWidth < $wWidth) {
     $watermark->scaleImage($iWidth, $iHeight);
     $wWidth = $watermark->getImageWidth();
        $wHeight = $watermark->getImageHeight();
    }
    $x = ($iWidth - $wWidth) / 2;
    $y = ($iHeight - $wHeight) / 2;
$im->compositeImage($watermark,imagick::COMPOSITE_DEFAULT,$x,$y); 

要做什么才能使水印(图像)显示在图像的后面而不是图像的前面。

您实际上可能需要编辑水印图像本身,使其几乎完全透明。当图像混合时,没有"前面"或"后面",更多的是重叠颜色的混合。

如果你让你的水印几乎不透明,那么它会在最终的图像中非常微妙地显示出来。