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
convert in.png \
-interpolate Nearest \
-filter point \
-resize 800% out.png