【问题标题】:Rotated an PNG image with PHP. How to remove the black lines around the original?使用 PHP 旋转 PNG 图像。如何去除原稿周围的黑线?
【发布时间】: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);

我在这里找到了答案:

http://ru2.php.net/manual/en/function.imagerotate.php#47985

【问题讨论】:

    标签: php image png transparency rotation


    【解决方案1】:

    我认为最好使用 imagick
    Here 是 PHP 的扩展

    或者如果你想要 GD 看这里
    http://ru2.php.net/manual/en/function.imagerotate.php#46338

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2010-09-08
      • 1970-01-01
      • 2012-07-08
      • 1970-01-01
      • 2021-10-12
      • 2017-01-18
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多