Skip to content

Instantly share code, notes, and snippets.

@Meettya
Created January 28, 2012 11:18
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Meettya/1693991 to your computer and use it in GitHub Desktop.
Save Meettya/1693991 to your computer and use it in GitHub Desktop.
simply bash bath image resizer
#!/bin/bash
#===================================
#
# This command resize all images
# in this dir and all sub dirs
# For common purpose
#
# usage:
# convert-bath.sh dirname
#
# (C) Meettya winter 2012
#===================================
prefix="res_"
size="1920x1080>"
if [ -d "$1" ]; then
find "$1" -type f ! -name "$prefix*" | while read fullname; do
echo "convert '$fullname'"
pathname=${fullname%/*}
filename=${fullname##*/}
convert "$fullname" -adaptive-resize $size "$pathname/$prefix$filename"
done
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment