Skip to content

Instantly share code, notes, and snippets.

@jhavard
Last active December 6, 2016 00:19
Show Gist options
  • Save jhavard/0310e7b6fa9a72973cd314556dc1d616 to your computer and use it in GitHub Desktop.
Save jhavard/0310e7b6fa9a72973cd314556dc1d616 to your computer and use it in GitHub Desktop.
quick little script to deal with image thumbnailing I need for a little project
#!/bin/bash
# The idea is to create the files in the same directory as the source image in a variety of image sizes
# as used by this particular template I am using.
SIZES="100x100 1132x411 1132x868 150x115 150x150 238x182 337x258 426x327 536x391 536x411 860x662 983x755"
for X in $SIZES ; do
DIR=`dirname $1`
FILE=`basename $1`
echo convert $1 -resize "${X}^" -gravity center -crop ${X}+0+0 +repage ${DIR}/scaled_${X}_${FILE}
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment