工作中需要縮放一些gif圖然后在去Imagecopymerge,可是發(fā)現(xiàn)使用了imagecreatetruecolor和imagecopyresampled后發(fā)現(xiàn)背景圖不對,本來透明的背景圖變成了黑色,后來發(fā)現(xiàn)做一些修改才可以:
$img = imagecreatetruecolor(200, 200);
//2.上色
$color=imagecolorallocate($img,255,255,255);
//3.設(shè)置透明
imagecolortransparent($img,$color);
imagefill($img,0,0,$color);
然后再進行imagecopyresampled和Imagecopymerge就沒有問題了
更多信息請查看IT技術(shù)專欄