【发布时间】:2011-08-22 11:05:27
【问题描述】:
我正在使用 PHP 旋转具有透明背景的 PNG 图像。但是无论我怎么尝试,原始图像周围仍然有一些黑线。
如何去除黑线。其他一切正常。图像是透明的,图像是旋转的,新的角也是透明的。只是原始正方形(旋转的)周围的黑线让我很烦。
我使用这个代码:
$angle = -100;
header('Content-type: image/png');
$image = 'http://mapning.com/img/plane.png';
$file = imagecreatefrompng($image);
$rotate = imagerotate($file, $angle, 0);
imageSaveAlpha($rotate, true);
ImageAlphaBlending($rotate, false);
$transparentColor = imagecolorallocatealpha($rotate, 200, 200, 200, 127);
imagefill($rotate, 0, 0, $transparentColor);
imagepng($rotate);
我在这里找到了答案:
【问题讨论】:
标签: php image png transparency rotation