blob: 11766509de4e131c1f753c400819290c10f8e0dd (
plain)
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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
|
#! /bin/sh
# Bourne shell script to cut slices of a JPG page image and make
# separate JPG files from each line. It used to convert to PNM to get the
# image size but this version assumes a whole uncropped page, so we give
# absolute coordinates for the starting-point. The master page is made
# by making a 1-page A4 PS file with dvips at 600dpi, then running GS on
# it with DEVICE=jpeggray and r=300. If you use other settings, open the
# JPG file in a graphics editor and work out initial values for LEFT, TOP,
# WIDTH, and SLICE by yourself.
# Peter Flynn, Silmaril Consultants, 2000/2001/2002/2003
if [ -z "$1" ]; then
echo You must give a filename to slice up
exit 1
else
FILE=`basename $1 .jpg`
# Starting-point for TLC of first slice
# LEFT=850
# TOP=614
LEFT=1000
TOP=2300
# WIDTH=`jpegtopnm $FILE.jpg | pnmfile | awk '{print $4}'`
# WIDTH=$[WIDTH-LEFT]
# WIDTH=1050
WIDTH=1000
HEIGHT=`jpegtopnm $FILE.jpg | pnmfile | awk '{print $6}'`
SLICE=50
BOTTOM=$SLICE
# we expect 36 lines of font samples
while [ $BOTTOM -lt $HEIGHT ]; do
BOTTOM=$[TOP+SLICE-1]
COUNT=$[COUNT+1]
if [ $COUNT -lt 10 ]; then
SEQ="0"$COUNT
else
SEQ=$COUNT
fi
echo Cutting slice $COUNT from $TOP to $BOTTOM
jpegtopnm $FILE.jpg | pnmcut $LEFT $TOP $WIDTH $SLICE | pnmcrop | ppmtojpeg >$FILE-$SEQ.jpg
TOP=$[BOTTOM+1]
# additional spacing to skip over table subheadings
if [ $COUNT = 21 ]; then
TOP=$[TOP + 136 - $SLICE]
elif [ $COUNT = 31 ]; then
TOP=$[TOP + 136 - $SLICE]
fi
done
fi
exit 0
|