imagecreatetruecolor() 返回一个图像标识符,代表了一幅大小为 x_size 和 y_size 的黑色图像。
改变其背景颜色可以用 imagefill 函数 imagefill() 在 image 图像的坐标 x ,y (图像左上角为 0, 0)处用 color 颜色执行区域填充(即与 x, y 点颜色相同且相邻的点都会被填充)。例如:改变图片背景色为黑色
@$ni = ImageCreatetruecolor($toW,$toH);
$background = imagecolorallocate($ni, 255, 255, 255);
imagefill($ni,0,0,$background);