Skip to content

Instantly share code, notes, and snippets.

@nuex
Created August 12, 2011 16:50
Show Gist options
  • Save nuex/1142446 to your computer and use it in GitHub Desktop.
Save nuex/1142446 to your computer and use it in GitHub Desktop.
rlc - resize like crazy - resize all images in a directory recursively
#!/bin/sh
#
# rlc: resize like crazy
#
# rlc.sh targetdir
target=$1
destination=$target-resized
dimensions=1000x
quality=100
mkdir $destination
# echo usage if arguments do not exist
if [ -z "$target" ]; then
echo "rlc.sh targetdir"
exit 0
fi
imagelist=imagelist.txt
# create image list
find $target/ -iname *.jpg -type f > $imagelist
gm mogrify -output-directory $destination -create-directories -resize $dimensions -quality $quality @$imagelist
rm $imagelist
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment