How to Pixelate an Image with ImageMagick Convert?

This article provides a quick overview and a step-by-step guide on how to pixelate an image using the ImageMagick convert command. Pixelation is a popular effect used to censor sensitive information or create retro pixel art, and it can be achieved efficiently in the command line by downscaling an image and then scaling it back up to its original size. Below, you will find the exact command structure, an explanation of how the parameters work, and examples for adjusting the pixel block size.

To pixelate an image using ImageMagick, you need to resize the image to a much smaller percentage of its original size and then scale it back up using the -scale option. The -scale option is crucial because it uses a nearest-neighbor interpolation method, which preserves the blocky, pixelated edges rather than smoothing them out.

The Standard Pixelation Command

Here is the fundamental command to achieve the pixelation effect:

convert input.jpg -scale 10% -scale 1000% output.jpg

How the Parameters Work

Adjusting the Intensity of the Pixelation

You can control how large or small the pixel blocks are by changing the percentages. The key is to ensure that the second percentage reverses the math of the first percentage so your final image size doesn’t change.