-
Notifications
You must be signed in to change notification settings - Fork 10
/
gifo.sh
executable file
·47 lines (37 loc) · 900 Bytes
/
gifo.sh
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
#!/bin/bash
## Make globally available with:
# sudo cp gifo.sh /usr/local/bin/gifo
# sudo chmod a+x /usr/local/bin/gifo
echo "== Add overlay to all images in this directory ==
";
function gifo_main ()
{
def_file="fil";
dir="merged";
# Accept the file to copy.
if [[ -n $1 ]]; then
file=$1;
# Use default file if can.
elif [[ -r $def_file ]]; then
echo "Will copy 'fil'";
file=$def_file;
else
echo "File is missing. What should I copy?"
exit;
fi
# Stored merged copies in a separate directory.
if [[ ! -d $dir ]]; then
mkdir $dir;
fi
# All files in directory except the source file and directories.
for f in `find . -maxdepth 1 -name "*.png"`
do
# Trim the ./ part .
f=${f:2};
target=$dir/$f;
# Merge those two files.
convert -gravity center $f $file -composite $target;
echo $target;
done
}
gifo_main