Skip to content

Instantly share code, notes, and snippets.

@blast-hardcheese
Created September 27, 2013 04:40
Show Gist options
  • Save blast-hardcheese/6724216 to your computer and use it in GitHub Desktop.
Save blast-hardcheese/6724216 to your computer and use it in GitHub Desktop.
adjust_size convenience function
adjust_size() {
size=$1
shift
if [ "x" = "x$size" -o -f "$size" ]; then
echo "Usage: adjust_size size_spec file [file2 [file3...]]"
return 1
fi
for P in "$@"; do
O="${P%\.*}-$size.${P##*\.}"
if [ -e "$O" ]; then
echo "Info: '$O' already exists, skipping.";
continue
fi
convert "$P" -resize $size -rotate 0 "$O"
done
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment