QuestionHow can I batch resize multiple images using Linux command line? Is there any tool which would help me with this and/or is there GUI application which makes image resizing easy. I have hundreds of images and therefore I'm in the need for such a tool which I also can use in combination with shell scripting.
AnswerThe best and the easiest way to resize multiple images using linux command line is to use
imagemagicktools. First you need to install
# apt-get install imagemagickOnce installed, you will have multiple image processing tools available to our disposal, such as convert, identify and etc.
identifycommand will help you to get some image information and convert will help you to convert images between hundreds of different image formats as well as it will easily resize any image submitted as an argument.
Let's suppose that our current working directory contains multiple image files with extension *.jpg . To resize all images to a half size of their original size we can combine bash for loop and convert command together in a following manner:
$ for i in $( ls *.jpg); do convert -resize 50% $i re_$i; doneThe command above will resize all images to half of its original size. New resized images will be saved with a prefix "re_". It is also possible to resize all images and at the same time convert them to gif format:
$ for i in $( ls *.jpg); do convert -resize 50% $i $i.gif; doneWhen it comes to GUI application which are able of batch image resizing you might look at Converseen .