I have an image and I want to resize and expand this image without spoiling it.
The image:
The image size:
- w=41
- h=43
The image size I want it resized to:
- w=2000x
- h=2100
I tried all the known methods:
- with PIL.Image:
from PIL import Image path = "image.png" w, h = 2000, 2100 img = Image.open(path) img = img.resize((w, h), Image.ANTIALIAS) img.save("re_image.png", "PNG") - with cv2:
import cv2 path = "image.png" w, h = 2000, 2100 img = cv2.imread(path) img = cv2.resize(img, (w, h), interpolation = cv2.INTER_AREA) cv2.imwrite("re_image.png", img)
The result is:




cv2.INTER_NEARESTis probably your best bet. All methods of interpolating between existing pixels will create some artefact. Especially at the scales you are attempting.