Resize Images From Terminal Using ImageMagick
ImageMagick – is a free software suite for the creation, modification and display of bitmap images.
There are other applications like GIMP that can be used to convert and resize images, but I like to do it the terminal way, which you might also give a try.
ImageMagick has a lot of additional utilities. Am going to talk about one of them, that is the convert.
If ImageMagick is not installed on your system you can install by running the commands below (Ubuntu)
$ sudo apt-get install imagemagick
After installation, we can now resize our images.
To resize an image
The syntax to follow:
$ convert old_image -resize % new_image
$ convert unixmen.jpg -resize 60% unixmen_new.jpg
Understanding the above command.
If we execute the above command, the image unixmen.jpg will be resized by 60% and saved under a new name unixmen_new.jpg. (Without modifying the original file unixmen.jpg)
Converting image formats
If you want to convert images from one format to another, ImageMagick can help you do that very easily by the help of a single command.
$ convert image_name.jpg image_name.png
$ convert unixmen.jpg unixmen.png
Running the above command quickly converts the image unixmen.jpg to a new format unixmen.png keeping the the first one intact without any modification.