Answers for "Image.fromarray"

1

pillow image from array

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

pil resize image

im = Image.open('image.jpg')  
im = im.resize((w, h))
Posted by: Guest on October-17-2020
-1

Image.fromarray

from PIL import Image
import numpy as np
radius = 0.5
size = 10
x,y = np.meshgrid(np.linspace(-1,1,size),np.linspace(-1,1,size))
f = np.vectorize(lambda x,y: ( 1.0 if x*x + y*y < radius*radius else 0.0))
z = f(x,y)
print(z)
zz = np.random.random((size,size))
img = Image.fromarray(zz,mode='L') #replace z with zz and it will just produce a black image
img.save('my_pic.png')
Posted by: Guest on March-10-2021

Browse Popular Code Answers by Language