Resizing images on Linux – ImageMagick convert command

With the resolution of today’s digital cameras it is often necessary to resize the files to make them smaller. You may want to reduce the file size before publishing them on the web, or sending in an email. There is however the convert command which is part of the ImageMagick suite. If you are running Linux then you most likely have that installed already, just man convert for more information. The most basic way to use convert is to give a file at a time on the command line:

convert -resize 50% original.jpg newsize.jpg

Alternatively you could replace the percentage with the actual size such as 640×480

convert -resize 640x480 original.jpg newsize.jpg

Where this really comes into it’s own is when you have a directory full of images that you want to convert. This can be used by using the xargs and find commands in conjunction with convert.

find . -iname "*.jpg" | xargs -l -i convert -resize 640x480 {} ../small/{}