import Image
import numpy as np
data = np.random.random((100, 100))
rescaled = (255.0 / data.max() * (data - data.min())).astype(np.uint8)
im = Image.fromarray(rescaled)
im.save('test.png')
Saving a Numpy array as an image (instructions)