pil resize img code example
Example 1: python pil resize image
from PIL import Image
img = Image.open("some_random_image.jpg")
resized_img = img.resize((WIDTH, HEIGHT))
resized_img.save("resized_image.jpg")
Example 2: pyhton image resize
from PIL import Image
from resizeimage import resizeimage
fd_img = open('test-image.jpeg', 'r')
img = Image.open(fd_img)
img = resizeimage.resize_cover(img, [200, 100])
img.save('test-image-cover.jpeg', img.format)
fd_img.close()
Example 3: pil resize image
im = Image.open('image.jpg')
im = im.resize((w, h))