Skip to content

Instantly share code, notes, and snippets.

@jarvist
Created September 24, 2010 00:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jarvist/594654 to your computer and use it in GitHub Desktop.
Save jarvist/594654 to your computer and use it in GitHub Desktop.
for i in *.jpg
do
id=` identify "${i}" | awk '{print $3}' | sed s/x/\ / `
x=` echo $id | cut -f1 -d\ `
y=` echo $id | cut -f2 -d\ `
echo $i X: $x Y: $y
if (( $x > 1024 ))
then
echo "TOO BROAD!"
convert "${i}" -resize 1024x tmp.jpg
mv tmp.jpg "${i}"
elif (( $y > 768 ))
then
echo "TOO TALL!"
convert "${i}" -resize x768 tmp.jpg
mv tmp.jpg "${i}"
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment