import pickle import numpy as np import pandas as pd from PIL import Image data = np.random.randint(0, 255, size=(300, 300, 3), dtype=np.uint8) img = Image.fromarray(data, 'RGB') #img.save('patch.png')