diff options
| author | SJP/farm <st33v@f3rr3t.com> | 2016-12-30 14:13:39 +1100 |
|---|---|---|
| committer | SJP/farm <st33v@f3rr3t.com> | 2016-12-30 14:13:39 +1100 |
| commit | 385cfadac62db154758f8b57961b72393fba07ed (patch) | |
| tree | a8b33a8db561ded38f8de8515d01a1acbd958063 /resize.sh | |
| parent | ccadaa014602cbac5f99cb627b078803df9ff531 (diff) | |
add 'resize.sh' script, written ages ago
Diffstat (limited to 'resize.sh')
| -rwxr-xr-x | resize.sh | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/resize.sh b/resize.sh new file mode 100755 index 0000000..54c7b77 --- /dev/null +++ b/resize.sh @@ -0,0 +1,32 @@ +#! /bin/bash +# resize photos and put them in a subdirectory +# default is 20% but can add in an arg later + + +if [ -z $1 ] + then reduce=25 + else reduce=$1 +fi + +if [ -z $2 ] + then smldir='sml' + else smldir=$2 +fi + + +mkdir $smldir +rename -v 's/\s/_/g' * +if [ $(ls -l *.JPG | wc -l) -gt 0 ] + then rename -v 's/.JPG$/.jpg/' *.JPG +fi + +numpix=$(ls -l *.jpg | wc -l) + + +for file in *.jpg + do convert ${file} -resize ${reduce}% ${smldir}/sml-${file} +done + +echo "${numpix} pictures were reduced to ${reduce}% and stored in ${smldir}." + +exit 0 |
