How to resize multiple images in Linux

Use imagemagick – this is exactly what it was designed for! 🙂

For example:
– to resize all .jpeg files in the current directory to be 320 pixels wide, preserving the aspect ration, do this:

 $ convert '*.jpeg[320x]' resized%03d.jpeg

– to shrink all .jpg files in the current directory to be 200 pixels wide, at the same time converting them to PNG, do:

$ convert '*.jpg[200x>]' my-resized-png-file%03d.png

All you need to do is specify the extension of the target file and imegmagik will figure the format automatically!

– Be careful when resizing files that came from Windows or a camera device – they will very likely have files named with uppercase charactes, eg, 20150628_120327.JPG, and in this case you need to adjust the command to reflect the case of the charactes in the filenames (remember that Linux is case sensitive!). So in this case, the first command will become:

$ convert '*.JPG[320x]' resized%03d.jpg

Leave a Reply

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