基本绘画流程
借助于Image.fromarray()函数,可以将NumPy生成的数组转为PIL对象。PIL对象的show()方法可以直接显示图像,save()方法则可以将图像保存为文件。...这一系列的操作过程中,有一个非常关键的知识点:NumPy数组的类型必须是单字节无符号整型,即np.uint8或np.ubyte类型。...>>> im = np.random.randint(, , (,), dtype=np.uint8)
>>> im = Image.fromarray(im)
>>> im.show() # 或者im.save...>>> im = np.random.randint(, , (,,), dtype=np.uint8)
>>> Image.fromarray(im, mode='RGB').show()
?...np.int32((y+)*0.9*/ + 0.05*)
>>> for i in range(, , ):
im[y[:-i],(x+i)[:-i]] = np.array([,,])
>>> Image.fromarray