Imagine you have to prepare thumbnails for a gallery or resize all images to insert into a presentation or, again, reduce photos to send them by email, etc.
Open each image with Gimp or Photoshop and resize them one by one is foolish. How can we perform this operation in a simple way and without stress?
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' *