Resize images with Linux


Use Linux command line. Resize multiple images with Linux is very simple by using ImageMagick suite.

First of all, let’s install ImageMagick that includes lots of tools to manipulate images. To do that, execute following command in terminal window:

$ sudo apt-get install imagemagick

Now, lots of new commands are available (check ImageMagick command line tools for more details). We will use mogrify that is designed to

resize an image, blur, crop, despeckle, dither, draw on, flip, join, re-sample, and much more.

Of course, it can work on one or more images at time. We simply can specify filename to act on a single image, or use command line wildcards to act on multiple files.

So, let’s see some examples of morgify usage. For more detailed informations and complete list of options, please check ImageMagick Mogrify manual page.

Resize an image to 75% of its original size:

$ mogrify -resize 75% image.jpg

Resize all JPG files in the folder 75% of their original sizes:

$ mogrify -resize 75% *.jpg

Resize all images in the folder to 640×480 pixels:

$ mogrify -resize '640x480' *

Resize all images to width of 640 pixel mantaining aspect ratio:

$ mogrify -resize width='640' *

Resize all images to height of 480 mantaining aspect ratio:

$ mogrify -resize width='x480' *