Resize Images by Terminal in Ubuntu, Debian and Linux Mint

In this article I will show you how to install and use imagemagick for resizing pictures. This tool is very easy to use, and this tutorial will make thing more clear. Gimp is also a good solution for manipulating picture files, but I find it faster to type one line in the terminal, instead of working with the graphical interface.

Install Imagemagick on Ubuntu 12.04, Ubuntu 12.10, Linux Mint 13 and Linux Mint 14:

$ sudo apt-get install imagemagick

Start using Imagemagick for resizing pictures:

This will replace the old picture.jpg with the 320×240 resized picture.jpg. This command keeps the aspect ratio.

$ mogrify -resize 320x240 picture.jpg

This will replace all the .png pictures in the current directory with the 320%240 resized pictures and keeps the aspect ratio:

$ mogrify -resize 320x240 *.png

Modify only the width of the picture.png to 320 and keep the aspect ratio:

$ mogrify -resize 340 picture.png

Modify only the height of the picture.png to 320 and keep the aspect ratio:

$ mogrify -resize x320 picture.png

Resize picture.png to 320×240 and modify the aspect ratio, if needed:

$ mogrify -resize 320x240! picture.png

Resize picture.png to 50% of the original file and keep aspect ratio:

$ mogrify -resize 50% picture.png


Tagged with: , , , , , , , ,
Posted in The Linux and Unix Articles!

Leave a Reply

Your email address will not be published. Required fields are marked *




Subscribe to get the latest Linux news and how to guides directly on your e-mail!