php水印具有透明度和不透明度

时间:2015-12-16 07:56:51

标签: php

我有一个水印图像,顶部有一个横幅和透明背景,我试图将其设置为40不透明度......透明背景变为"颜色"相反..我怎么能这样做只有不透明的部分有40%的不透明度,但透明背景保持透明?

banner on top, bottom transparent background

tested outcome

define('WATERMARK_OVERLAY_OPACITY', 45);

$dest_image = imagecreatetruecolor($percent, $percent);

imagealphablending(
    $dest_image,
    false 
);

imagesavealpha( 
   $dest_image,  
   true 
);

imagecopymerge(
   $source_gd_image,
   $dest_image,
   round($positionx),
   round($positiony),
   0,
   0,
   $percent,
   $percent,
   WATERMARK_OVERLAY_OPACITY
);

0 个答案:

没有答案
相关问题