Home / Tools / Resampling

Resampling filters compared

Which filter you pass to resize changes the result more than most people expect. Open an image and see all four on the same picture.

Nothing is uploaded. The resizing happens in your browser.

Which one to use

FilterUse it forWatch out for
NEARESTPixel art, masks, palette images, anything where invented colours are wrongJagged edges and dropped detail when shrinking
BILINEARQuick previews, mild enlargementSoft results, poor when shrinking a lot
BICUBICGeneral enlargement, a reasonable defaultSlight halos on hard edges
LANCZOSShrinking photographs, thumbnails you care aboutSlowest, and can ring on very sharp edges
from PIL import Image

im = Image.open("photo.jpg")
small = im.resize((320, 240), Image.Resampling.LANCZOS)

If you only take one thing away: when you are shrinking, the filter matters far more than when you are enlarging, because the filter decides how many original pixels contribute to each new one. NEAREST looks at exactly one and throws the rest away, which is why fine detail turns into noise.

Is this really what Pillow does

Yes, the same maths, implemented here in JavaScript. The kernels are the ones Pillow uses, including the support widening that Pillow applies when shrinking, which is the part that makes the difference between a proper filter and a browser resize.

Checked against Pillow 12 on an 800 pixel image reduced to 200: NEAREST comes out pixel for pixel identical, and the other three differ by an average of under a tenth of one level of brightness, which is rounding.

A note on thumbnail

im.thumbnail(size) already uses a good filter by default and keeps the aspect ratio, so for simple thumbnails you rarely need resize at all. It also changes the image in place rather than returning a new one.