我有腳本爲圖像(JPG)添加水印(PNG,透明)。在捕捉時可以很好地工作 - 在某些方面,水印會改變顏色並使其不透明。 這是我的代碼使用加水痕:PHP創建的水印看起來很奇怪
$im = imagecreatefromjpeg('../../pics/'.$ran.'_large.jpg');
$stamp = imagecreatefrompng('a.png');
$marge_right = 10;
$marge_bottom = 10;
$sx = imagesx($stamp);
$sy = imagesy($stamp);
imagecopymerge($im, $stamp, imagesx($im) - $sx - $marge_right, imagesy($im) - $sy - $marge_bottom, 0, 0, imagesx($stamp), imagesy($stamp), 70);
// Save the image to file and free memory
imagejpeg($im, '../../pics/'.$ran.'_large.jpg');
imagedestroy($im);
Image with watermark after PHP generates it (wrong way)