可以这样 $nimg=imagecreatetruecolor(100,100); $black=imagecolorallocate($nimg,0,0,0); imagefill($nimg,0,0,$black)