思路:
根据宽和高imagecreatetruecolor()
二重循环,使用imagecolorallocate()确定颜色和用imagesetpixel()着色
imagejpeg()或imagegif()输出图像各函数用法参考PHP Manual
Gook luck~