Created
January 26, 2011 14:43
-
-
Save chluehr/796772 to your computer and use it in GitHub Desktop.
Shell Script to resize / crop images via ImageMagick (min. V6.3.8)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
#========================================== | |
# source size is 300x300 .. | |
function resizecrop { | |
SIZE=$1 | |
SRCFILE=$2 | |
DESTFILE=$3 | |
convert -size 300x300 $SRCFILE \ | |
-thumbnail ${SIZE}x${SIZE}^ \ | |
-gravity center \ | |
-extent ${SIZE}x${SIZE} \ | |
$DESTFILE | |
} | |
for i in *.jpg | |
do | |
resizecrop 100 "$i" `basename $1 .jpg`_100x100.jpg | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment