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