Mobile app version of vmapp.org
Login or Join
Nimeshi706

: Nearest neighbour interpolation not working in ImageMagick I want to display an image and have the pixels big and clearly visible. As it's common to display scaled image with some form of smooth

@Nimeshi706

Posted in: #Imagemagick #Pixelation #Resize

I want to display an image and have the pixels big and clearly visible. As it's common to display scaled image with some form of smooth filtering, the best option is to scale up the image resolution without interpolation (i.e. nearest). I have quite a few and need automation, hence ImageMagick.

I'm certain I've done this before and hit the same problem, but this time Google isn't helping. I vaguely remember the order of the arguments can be quite important here but I've tried every permutation and the output is the same.

The following simply doesn't work. It resizes the image correctly but it's all blurry:

convert from.png -interpolate Nearest -resize 800% to.png


What am I missing?



Example:

I start with

I get this

But want this



Related links:


ImageMagick v6 Examples - Simple Interpolation Methods
ImageMagick: Command-line Options - interpolate

10.01% popularity Vote Up Vote Down


Login to follow query

More posts by @Nimeshi706

1 Comments

Sorted by latest first Latest Oldest Best

 

@Frith110

Silly me. I found a solution in my bash history. I needed to set -filter point.

convert from.png -interpolate Nearest -filter point -resize 800% to.png


The default filter appears to be Cubic for me. Interestingly, -interpolate Nearest doesn't seem to affect the output at all and may not be needed above. I'd love to know why and won't accept this as the answer.

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme