Skip to content

resize images via shell

The Problem: You have a bunch of images (like files in an directory ;-)) you want to resize.

The Solution (an easy one):

#!/bin/sh mkdir 800px for f in *.jpg do convert $f -verbose -resize 800 -quality 90% -comment "powered by open source" 800px/$f done

As far as you see, this shell script creates a directory called "800px" and walks to every file with the ending "jpg". The script resize every file to a with of 800 pixels and saves it into "800px". Just change in the directoy with the images you want to resize and type in "sh path/to/my/convert/script.sh". If the command "convert" is not on your system, try to install "imagemagick".