• INTER_NEAREST – a nearest-neighbor interpolation
  • INTER_LINEAR – a bilinear interpolation (used by default)
  • INTER_AREA – resampling using pixel area relation. It may be a preferred method for image decimation, as it gives moire’-free results. But when the image is zoomed, it is similar to theINTER_NEAREST method.
  • INTER_CUBIC – a bicubic interpolation over 4×4 pixel neighborhood
  • INTER_LANCZOS4 – a Lanczos interpolation over 8×8 pixel neighborhood

from the official docs.

I use this often when using cv2.resize method. For example,

import cv2

img = cv2.imread("testimage.png")
resized = cv2.resize(img, (100,100), interpolation=cv2.INTER_LINEAR)

reducing resize results

here is the default image.(50×50)

default image

and here are the results of reducing it to 15×15 with various interpolation methods.


enlarge resize results

with the same default image used above, here are the results when it is enlarged to 100×100


Categories: python


makaros · June 3, 2019 at 9:50 pm

How exactly does nearest-neighbor interpolation behaves when you downscale an image from 50×50 to 15×15? How is this 15×15 images filled in with values ?

nkumar · September 26, 2019 at 3:48 pm

good discussion. are there any other method that retains the sharpness of edges when compressing? i feel edge detection is compromised when using the standard options.

Pierre · May 26, 2020 at 10:24 pm

That’s was useful ! Thanks 🙂

Anonymous · July 31, 2020 at 7:12 pm

good comparision

Shraddha · February 2, 2021 at 7:08 am

Thank you for creating this and showing a clear difference. it was useful.

Ethan · April 30, 2021 at 9:14 pm

Great post! The example images really help you decide what type of interpolation you want.

Dan · May 7, 2021 at 8:14 pm

Which method is the fastest, INTER_LINEAR maybe?

Jane Courtney · June 28, 2021 at 8:55 pm

The simplicity of this post is helpful and joyous! Thank you.

Anonymous · March 19, 2022 at 9:07 pm

Any paper as referencef?

Yoann · May 13, 2022 at 11:20 pm

I think it will be better to show the image without the interpolation made by the viewer itself. For example, if you print this image with matplotlib, and you don’t the small image to be blurry, you have to add interpolation=”None” or “nearest” to show the real result behind. If you view the image with your own image viewer, be careful to deactivate the anti-aliasing option in parameters 😀

Leave a Reply

Your email address will not be published.