Why does this transparent PNG cause borders when combined using GD?

前端 未结 2 1172
北荒
北荒 2020-12-19 10:09

I am trying to create an image from an another image using PHP. Here is my code:



        
2条回答
  •  一向
    一向 (楼主)
    2020-12-19 10:58

    Can you try to enable alpha blending on $image before you copy the original to it:

    imagealphablending($image, true); 
    

    Second try would be to create a transparent color and to fill $image with that color before the copy.

    $transparent = imagecolorallocatealpha($image, 0, 0, 0, 127);
    imagefill($image, 0, 0, $transparent);
    imagealphablending($image, true); 
    

提交回复
热议问题