Archive

Posts Tagged ‘pictures’

Resize and auto orientate pictures

February 9th, 2009 No comments

If you have a linux system with ImageMagick, you can easily resize and auto orientate pictures with a bash script.

Just create a file called resize.sh with the following content:

#!/bin/bash
size=$1
path=$2
list=`find $path*`

for file in $list; do
        echo $file
        convert -auto-orient -resize $size $file $file
done
exit 0

And give it execute rights.
When you call “./resize.sh 1024 /home/user/pictures/” every picture in /home/user/pictures will be auto-orientated and scaled to a max height or width of 1024 pixels. The auto-orientate is done by looking at the exif info.