summaryrefslogtreecommitdiffstats
path: root/scan-multi
blob: 7c9cb7fa8ee833902b890411c1802a11a450a0b9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#!/bin/bash

time=$(date +%Y-%m-%d_%H%M%S)
scanimage --resolution 200 -b -x 214.98 -y 294.973
i=1
while [[ -e "out$i.pnm" ]]; do
	img="out$i.pnm"
	newname="$(printf "%s_%03d" "$time" "$i")"
	convert "$img" -normalize -quality 70 "$newname.jpg" && rm "$img"
	((i++))
done

if [[ $1 = "--pdf" ]]; then
	convert "${time}"_*.jpg -resize 1500x1500 "${time}.pdf" && rm "${time}"_*.jpg
fi