Graphic Design Stack Exchange is a question and answer site for Graphic Design professionals, students, and enthusiasts. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Is there a command-line utility for Linux that can pixelate an image by a specified percentage eg "-pixelate 30%"

share|improve this question
up vote 3 down vote accepted

I think the usual trick is to scale down so that you lose resolution and then scale up to magnify the low-res image. So with Imagemagick, something like this:

convert -scale 10% -scale 1000% original.jpg pixelated.jpg

UPDATE: if you just want to be able to specify a single "pixelation amount" value, then the above command can be wrapped in a shell script as follows


AMOUNT=$(echo "1.001 - $1" | bc -l)

COEFF1=$(echo "100 * $AMOUNT" | bc -l)
COEFF2=$(echo "100 / $AMOUNT" | bc -l)


If you then save the above script as and make it executable with chmod 755, you can run it by specifying a pixelation amount between 0-1, an input file and an output file. For example:

./ 0.5 original.jpg pixelated.jpg
share|improve this answer
Thanks! For my purposes this works great. I've noticed that if you use an input image with a dimension ending in an odd number the output size is different from the input. However, I can live with this ;-) – hellocatfood Jul 19 '12 at 19:41

If you have ruby installed this might be a possible option for you.

See this gist

It uses chunky_png to pixellate the image, so you may need to adapt the code slightly if you want to produce other file formats.

For more information about it see this link

Not sure how comfortable you with adapting code, but I could try to convert it into a simple command line application if you think it would be worthwhile.

share|improve this answer
Thanks for this suggestion. I like that it allows me to specify pixelation amount. I've marked Jamie's answer as the best answer as imagemagick is easier to install than chunkypng, but should I ever need a ruby solution I'll know where to look. Thanks again! – hellocatfood Jul 19 '12 at 19:44

So, if you know how to do this with the Gimp via the point-and-click interface then you can probably write batch-mode script to do the same thing on the command line:

share|improve this answer
Thanks for the suggestion but it doesn't really provide me with an answer – hellocatfood Jul 16 '12 at 0:05

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.