-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcreate-testdata.sh
executable file
·48 lines (40 loc) · 1.04 KB
/
create-testdata.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
48
#!/bin/bash
#
# Convert source testimage to testdata in various formats
#
which xxd > /dev/null || { echo "xxd tool needed"; exit 1; }
which convert > /dev/null || { echo "convert tool needed"; exit 1; }
which boxer > /dev/null
box=$?
# Image formats
for f in png tiff jpeg; do
rm -rf $f > /dev/null
mkdir -p $f > /dev/null
for i in source/jpg/*.jpg; do
for s in 100 50 25 12 ; do
o=$f/$(basename $i .jpg)-x$s.$f
convert $i -resize "$s%" $o
b="$(dirname $o)/$(basename $o .$f)"
xxd -i $o $b.h
identify $o
if [ "$box" == "0" ] ; then
boxer -i $o -f 4k-controlframe-v7 $b.raw
xxd -i ${b}_0000.raw | sed -e 's/ 0x0//g' > ${b}_0000.h
fi
done
done
done
# PDF
mkdir pdf > /dev/null
for i in source/pdf/*.pdf; do
b="pdf/$(basename $i .pdf).h"
echo "$i -> $b"
xxd -i $i $b
done
# WAV
mkdir -p wav
for i in source/wav/*.wav; do
b="wav/$(basename $i .wav).h"
echo "$i -> $b"
xxd -i $i $b
done