-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathgenerate
executable file
·66 lines (47 loc) · 1.86 KB
/
generate
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
#!/bin/bash
CBLUT=${CBLUT-./cblutgen}
OPS=${OPS-"-m 1 -isxXyY"}
OUT=${OUT-out}
DISPLAY_WIDTH=${DISPLAY_WIDTH-256}
mkdir -p $OUT
pushd $OUT
echo "Results for Protanopia" > results-protanope.md
echo "Results for Deuteranopia" > results-deuteranope.md
echo "Results for Tritanopia" > results-tritanope.md
for c in protanope deuteranope tritanope; do
cat << EOF >> results-$c.md
-------
From left to right: original, Daltonised (Fidaner), corrected (Willmott),
simulated colour blindness, Daltonised + simulated, corrected + simulated.
EOF
done
for i in ../tests/*.*; do
BASE=${i##*/}
IMAGE=${BASE%.*}
echo "=== processing " $IMAGE
mkdir -p $IMAGE
pushd $IMAGE
# Because we modify the originals, which are for red/green colour-blindness,
# by using -rL for Tritanopia, we must make variant copies of the identity
../../$CBLUT -f ../$i -p $OPS
mv ${IMAGE}_identity.png ${IMAGE}_protanope_identity.png
../../$CBLUT -f ../$i -d $OPS
mv ${IMAGE}_identity.png ${IMAGE}_deuteranope_identity.png
../../$CBLUT -f ../$i -t -rL $OPS
mv ${IMAGE}_identity.png ${IMAGE}_tritanope_identity.png
popd
echo "updating results-$c.md"
for c in protanope deuteranope tritanope; do
cat << EOF >> results-$c.md
$IMAGE
---
<img src="$IMAGE/${IMAGE}_${c}_identity.png" alt="Original" width="$DISPLAY_WIDTH"/>
<img src="$IMAGE/${IMAGE}_${c}_daltonise.png" alt="Daltonised" width="$DISPLAY_WIDTH"/>
<img src="$IMAGE/${IMAGE}_${c}_correct.png" alt="Corrected" width="$DISPLAY_WIDTH"/>
<img src="$IMAGE/${IMAGE}_${c}_simulate.png" alt="Simulated" width="$DISPLAY_WIDTH"/>
<img src="$IMAGE/${IMAGE}_${c}_simulate_daltonised.png" alt="Simulated Daltonised" width="$DISPLAY_WIDTH"/>
<img src="$IMAGE/${IMAGE}_${c}_simulate_corrected.png" alt="Simulated Corrected" width="$DISPLAY_WIDTH"/>
EOF
done
done
popd