-
Notifications
You must be signed in to change notification settings - Fork 6
/
internal_image_creator.sh
executable file
·44 lines (38 loc) · 1.75 KB
/
internal_image_creator.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
#!/bin/bash
#
# Creates the sample images for Quack from originals.
# This script is only relevant if the caller has access
# to the original scanned files. These are not stored
# with the Quack code as their cumulative size is 34MB.
# Contact Toke Eskildsen - [email protected] if
# the originals are of interest.
#
# Requires bash & GraphicsMagick
#
ORIGINALS="/mnt/bulk/data/quack_samples"
COMMAND="-geometry 40%x -level 0,1.0,220 -quality 55 -type Grayscale"
FROM_TO="AdresseContoirsEfterretninger-1795-06-16-02-0018B,ACE-17950616-0018B AdresseContoirsEfterretninger-1795-06-16-02-0019A,ACE-17950616-0019A AdresseContoirsEfterretninger-1795-06-16-02-0019B,ACE-17950616-0019B"
# We would like samples from other time periods, but only the 200+ years
# old ones are currently cleared for distribution.
#FROM_TO="AdressecomptoirsEfterretninger-1846-01-20-01-0029A,ACE-18460120-0029A AdressecomptoirsEfterretninger-1846-01-20-01-0031B,ACE-18460120-0031A AdresseContoirsEfterretninger-1795-06-16-02-0018B,ACE-17950616-0018B"
SAMPLES="samples"
if [ ! -d $ORIGINALS ]; then
echo "The originals folder $ORIGINALS does not exist."
if [ ! "te" == `whoami` ]; then
echo "The user name `whoami` indicates you are not Toke Eskildsen."
echo "This implies that you do not have the originals used to regenerate the samples."
echo "Please ensure that the originals are available at ${ORIGINALS}."
fi
exit 2
fi
if [ ! -d $SAMPLES ]; then
mkdir $SAMPLES
fi
for FT in $FROM_TO; do
SRC=`echo "$FT" | cut -d, -f1`
DEST=`echo "$FT" | cut -d, -f2`
echo "Generating sample from ${SRC} to ${DEST}"
gm convert ${ORIGINALS}/${SRC}.png $COMMAND ${SAMPLES}/${DEST}.jpg
cp ${ORIGINALS}/${SRC}.alto.xml ${SAMPLES}/${DEST}.alto.xml
done
echo "Done"