matrix to PIL image python code example
Example 1: pil image from numpy
from PIL import Image
PIL_image = Image.fromarray(numpy_image.astype('uint8'), 'RGB')
Example 2: pil image to numpy
>>> pix = numpy.array(pic)
from PIL import Image
PIL_image = Image.fromarray(numpy_image.astype('uint8'), 'RGB')
>>> pix = numpy.array(pic)