数字数据转图片

from PIL import Image
from numpy import eye
import numpy as np
if __name__ == '__main__':
    arr=np.array([
        [0,15,30,45],
        [60,75,90,105],
        [120,135,150,175],
        [190,205,220,245],
        [0,0,0,0],
        [255,255,255,255],

    ]).astype('uint8')
    im = Image.fromarray(arr) # monochromatic image
   #RGB 为灰度图
    imrgb = Image.merge('HSV', (im,im,im)) # color image
    imrgb.show()

原文地址:https://www.cnblogs.com/similarface/p/6590342.html