summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSJP/farm <st33v@f3rr3t.com>2016-12-30 14:13:39 +1100
committerSJP/farm <st33v@f3rr3t.com>2016-12-30 14:13:39 +1100
commit385cfadac62db154758f8b57961b72393fba07ed (patch)
treea8b33a8db561ded38f8de8515d01a1acbd958063
parentccadaa014602cbac5f99cb627b078803df9ff531 (diff)
add 'resize.sh' script, written ages ago
-rw-r--r--.gitignore2
-rwxr-xr-xresize.sh32
2 files changed, 34 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore
index ae2ad53..c40ba3e 100644
--- a/.gitignore
+++ b/.gitignore
@@ -18,3 +18,5 @@ nytprof.out
*.o
*.bs
/_eumm/
+
+/myob/
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