Answers for "pillow image to np array"

9

ndarray to pil image

from PIL import Image
image_from_array = Image.fromarray(nd_array)
Posted by: Guest on July-28-2020
3

display np array as image

from PIL import Image
import numpy as np

w, h = 512, 512
data = np.zeros((h, w, 3), dtype=np.uint8)
data[0:256, 0:256] = [255, 0, 0] # red patch in upper left
img = Image.fromarray(data, 'RGB')
img.save('my.png')
img.show()
Posted by: Guest on June-08-2020
4

pil image to numpy

>>> pix = numpy.array(pic)
Posted by: Guest on June-17-2020
1

pillow image from array

PIL.Image.fromarray(your_array)
Posted by: Guest on May-12-2020

Python Answers by Framework

Browse Popular Code Answers by Language