← back to code snippets

Quickly batch resize images using ImageMagick

Posted on April 28th, 2015

ImageMagick can be used to quickly batch resize images without using any crazy user interface such as Photoshop, or GIMP.

imageImageMagick Logo

ImageMagick is an open source[1] software suite for displaying, converting, and editing raster image files. It can read and write over 200 image file formats. ImageMagick is licensed under the Apache 2.0 license.”

So this is all you would need to do to resize all images within a directory, whilst also maintaining the aspect ratio:

sudo mogrify -resize 350 *

That’s it, just one line! And it takes just a few seconds to run.

If you wanted, you could specify the file extensions, e.g.

sudo mogrify -resize 350 *.jpg

sudo mogrify -resize 350 *.png