我有两个PNG文件,“red.PNG”和“blue.PNG”;它们基本上都是透明的,但在不同的地方有几个像素的红色或蓝色斑点。
$original = getPNG('red.png');
$overlay = getPNG('blue.png');
imagecopymerge($original, $overlay, 0,0, 0,0, imagesx($original), imagesy($original), 100);
header('Content-Type: image/png');
imagepng($original);
imagealphablending($original, false);
imagesavealpha($original, true);
(在原版和套印版上?)这似乎没有任何帮助。
我在PHP.net上看到了一些变通方法,包括:
$throwAway = imagecreatefrompng($filename);
imagealphablending($throwAway, false);
imagesavealpha($throwAway, true);
$dstImage = imagecreatetruecolor(imagesx($throwAway), imagesy($throwAway));
imagecopyresampled($dstImage, $throwAway,0,0,0,0, imagesx($throwAway), imagesy($throwAway), imagesx($throwAway), imagesy($throwAway));
我该怎么办?!