-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinsert-exif
executable file
·53 lines (47 loc) · 1.05 KB
/
insert-exif
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#!/bin/bash
if [ $# -lt 2 ]; then
echo "${0##*/} <directory> <filespec>"
exit
fi
if [ -f $1 ]; then
echo ERROR: $1 is a filename
echo please give a directory
exit
fi
TGTDIR=$1
shift
echo begin to process $# files
# are files present?
if [ ! -f $1 ]; then
echo nothing to do
exit
fi
mkdir -p $TGTDIR
START_TIME=$SECONDS
j=0
echo -n creating overlays ...
while [ $# -ne 0 ]; do
if [ ! -f $TGTDIR/$1 ]
then
j=$(($j+1))
# check: die bilder liegen schon 1280x720 vor
# convert $1 -resize 1280x960 $1
if (($? != 0)); then
echo "$?: couldn't convert $1"
else
convert $1 -font EnvyCodeR -gravity SouthEast -pointsize 24 -fill Magenta -annotate +12+12 "%[EXIF:DateTimeOriginal]" $TGTDIR/$1
if (($? != 0)); then
echo "$?: couldn't annotate $1"
else
if [ -z "$PS1" ]; then # interactive
echo "$1 ok"
fi
touch -r $1 $TGTDIR/$1
rm $1
fi
fi
fi
shift
done
ELAPSED_TIME=$(($SECONDS - $START_TIME))
echo $j files converted in $(($ELAPSED_TIME/60/60)) hrs, $(($ELAPSED_TIME/60%60)) min and $(($ELAPSED_TIME % 60)) sec