a = [[0, 0, 0, 255, 255, 255, 0, 0, 0], [0, 0, 0, 255, 255, 255, 0, 0, 0],
    [255, 255, 255, 0, 0, 0, 255, 255, 255]]
a = np.array(a)
How to, given a 2D numpy arrayMatrix that contains "triplets" of RGB values generate an image?