summaryrefslogtreecommitdiffstats
path: root/scan-multi
blob: 44b580c79601a0dc611c85c0f8b95e3fff0031cf (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 95 "$newname.jpg" && rm "$img"
	((i++))
done

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