Nono.MA

[Solved] Mogrify Resize Image using Nearest Neighbors

JUNE 19, 2021

To avoid ImageMagick from interpolating pixels when you want a sharp resize method (equivalent to PIL's Image.NEAREST_NEIGHBOR) you can use mogrify and set the -filter to point.

# Assuming we're upscaling an image smaller than 2000x2000 pixels
mogrify -resize 2000x2000 -filter point image.png

Code