[英]GIF transparent background turned yellow
GIF图片不支持Alpha通道透明度。
由于您尝试将现有的图像颜色设置为透明,因此需要在调色板中找到它。 您可以使用imagecolorexact
做到这一点:
$srcImage = imagecreatefromgif($_FILES['img']['tmp_name']);
$bg = imagecolorexact($srcImage, 204, 168, 46); // RGB here matches the yellowish colour in your image.
imagecolortransparent($srcImage, $bg);
imagegif($srcImage, 't.gif');
结果:
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.