Skip to content

Instantly share code, notes, and snippets.

@ronaldronson
Created January 13, 2014 09:18
Show Gist options
  • Save ronaldronson/8396995 to your computer and use it in GitHub Desktop.
Save ronaldronson/8396995 to your computer and use it in GitHub Desktop.
Find and resize all images
#!/bin/sh
ALL_IMGS=`find . *.jpg -type f -name '*.jpg'`
for I in ${ALL_IMGS}
do
DEM_H=`identify -format "%h" ${I}`
DEM_W=`identify -format "%W" ${I}`
echo ${I} - ${DEM_H} x ${DEM_W}
if [ ${DEM_H} -gt ${DEM_W} ]; then
if [ ${DEM_H} -gt 600 ]; then
`convert -resize x600 $I $I`
fi
else
if [ ${DEM_W} -gt 600 ]; then
`convert -resize 600x $I $I`
fi
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment