-
Notifications
You must be signed in to change notification settings - Fork 7
/
demo_scale.sh
executable file
·55 lines (47 loc) · 1.29 KB
/
demo_scale.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
49
50
51
52
53
54
55
#!/bin/bash
# Creates arbitrarily large collages from ImageMagic sample images
#
# Intended for scale testing
: ${MAX_IMAGES:="$1"}
: ${BACKGROUND:=000000}
: ${RAW_W:=4}
: ${RAW_H:=3}
usage() {
echo "Usage:"
echo "./demo_scale.sh images"
exit $1
}
if [ "." == ".$MAX_IMAGES" ]; then
usage 1
fi
DEST=downloads/scale_${RAW_W}x${RAW_H}
JDEST=scale_${RAW_W}x${RAW_H}_${MAX_IMAGES}
if [ -d $JDEST ]; then
>&2 echo "Error: Destination $JDEST already exists"
exit 1
fi
# Create a few sample images
mkdir -p $DEST
echo "- Creating sample images"
SAMPLES=0
for C in green red blue yellow magenta black white orange; do
if [ ! -s $DEST/sample_${C}.png ]; then
convert logo: -geometry $((RAW_W*256))x$((RAW_H*256)) -fill $C -colorize 50% $DEST/sample_${SAMPLES}.png
fi
SAMPLES=$((SAMPLES+1))
done
# Create image list of arbitrary size with fake meta-data
echo "- Creating image list with $MAX_IMAGES entries"
COUNTER=0
SAMPLE=0
rm -f demo_scale.images.dat
while [ $COUNTER -lt $MAX_IMAGES ]; do
echo "$DEST/sample_${SAMPLE}.png|Meta-data place holder #$COUNTER" >> demo_scale.images.dat
COUNTER=$((COUNTER+1))
SAMPLE=$((SAMPLE+1))
if [ $SAMPLE -eq $SAMPLES ]; then
SAMPLE=0
fi
done
echo "- Activating juxta"
./juxta.sh demo_scale.images.dat $JDEST