compress-image.sh 361 Bytes
Newer Older
sajolida's avatar
sajolida committed
1
2
#!/bin/bash

sajolida's avatar
Harden    
sajolida committed
3
4
5
set -e
set -u

6
7
if [ ! -x /usr/bin/trimage ]; then
    echo "Please install the \"trimage\" package." >&2
sajolida's avatar
sajolida committed
8
9
10
    exit 1
fi

11
12
if [ ! -x /usr/bin/mat2 ]; then
    echo "Please install the \"mat2\" package." >&2
sajolida's avatar
sajolida committed
13
14
15
    exit 1
fi

sajolida's avatar
sajolida committed
16
for image in "${@}" ; do
17
    mat2 "${image}"
18
    trimage -f "${image}"
19
    mv "${image%.*}.cleaned.${image##*.}" "${image}"
sajolida's avatar
sajolida committed
20
done