15 [ $max -gt 0 ] || die "Usage:\n[IMG_PREFIX=your_prefix] $0 img1.jpg img2.jpg ..."
16 [ -x "$(which convert)" ] || die "ImageMagick is not installed"
17 [ -x "$(which jhead)" ] || die "jhead is not installed"
19 while [ $# -gt 0 ]; do
20 dst="$IMG_PREFIX$(seq -w $cur $max|head -n1).jpg"
21 echo -e "[$((100*cur/max))%]\t$1\t-> $dst"
23 [ -f "$1" ] || die "$1 does not exist"
24 (! [ -e "$dst" ]) || die "$dst already exists"
27 $(identify $1 |cut -f3 -d\ |tr x \ )
30 [ $W -ge 100 ] && [ $H -ge 100 ] || die "image is too small"
32 if [ $W -ge 1000 ]; then DW=$((W / 100)); else DW=10; fi
33 if [ $H -ge 1000 ]; then DH=$((H / 100)); else DH=10; fi
40 -distort Perspective "$(
41 ( echo $(r $DW) $(r $DH) 0 0
42 echo $(($W - $(r $DW))) $(r $DH) $W 0
43 echo $(r $DW) $(($H - $(r $DH))) 0 $H
44 echo $(($W - $(r $DW))) $(($H - $(r $DH))) $W $H
46 -filter gaussian -define filter:support=5 -define filter:sigma=0.5 \
47 -attenuate 2 +noise Uniform \
52 jhead -purejpg -q "$dst" || die "removing meta-data failed"