1
我试图使图像透明使用来自PHP的GD库,但运行下面的代码,只有一部分将是透明的。我试图使图像透明使用来自PHP库的GD库,但运行下面的代码,只有一部分将是透明的
$image = imagecreatefrompng("$second");
imagealphablending($image, false);
$col_transparent = imagecolorallocatealpha($image, 0, 0, 0, 127);
imagefill($image, 0, 0, $col_transparent); // set the transparent colour as the background.
imagecolortransparent ($image, $col_transparent); // actually make it transparent
imagesavealpha($image, TRUE);
header('Content-Type: image/png');
imagepng($image);
这里有原始图像:https://postimg.org/image/y68nw57z1/
这是产生的图像:https://postimg.org/image/o4n3t6ic7/
正如你所看到的,存在从保持白色所产生的图像部分。
我该如何解决这个问题?
工作。谢谢tim – Louie
不客气。请注意,[礼仪](http://stackoverflow.com/help/someone-answers)将接受为您的问题提供最佳解决方案的答案。 – timclutton
存在提高图像质量的模式? – Louie