Answers for "pil resize numpy array"

10

python pil resize image

from PIL import Image

# Image.open() can also open other image types
img = Image.open("some_random_image.jpg")
# WIDTH and HEIGHT are integers
resized_img = img.resize((WIDTH, HEIGHT))
resized_img.save("resized_image.jpg")
Posted by: Guest on April-05-2020
3

resize numpy array image

import cv2
import numpy as np

img = cv2.imread('your_image.jpg')
res = cv2.resize(img, dsize=(54, 140), interpolation=cv2.INTER_CUBIC)
Posted by: Guest on December-13-2020

Python Answers by Framework

Browse Popular Code Answers by Language