blob: 54c7b77a47797a28189c8d2964809207db913d82 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
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
|