您可以使用PIL创建(并显示)图像:
from PIL import Imageimport numpy as npw, h = 512, 512data = np.zeros((h, w, 3), dtype=np.uint8)data[0:256, 0:256] = [255, 0, 0] # red patch in upper leftimg = Image.fromarray(data, 'RGB')img.save('my.png')img.show()
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)