X-Git-Url: http://www.git.stargrave.org/?a=blobdiff_plain;f=bin%2Fbin%2Fscan.sh;h=d5c905feb48c57a1a4edf10e872f9ebd733ec30b;hb=HEAD;hp=0ae6fd4a8de71e0ed6e7e70c699af84755c3b867;hpb=01a8ec71a8592fe68da2b2d9f829379b34b6ad73;p=dotfiles.git diff --git a/bin/bin/scan.sh b/bin/bin/scan.sh deleted file mode 100755 index 0ae6fd4..0000000 --- a/bin/bin/scan.sh +++ /dev/null @@ -1,83 +0,0 @@ -#!/bin/sh - -rotate=0 -crop=0 -cur=noname.ppm -ctr=${1:-1} -ctr=$(( $ctr - 1 )) - -scan() { - resolution=$1 - shift - [ -z "$NEGATIVE" ] && src="Flatbed" || src="Transparency Adapter" - [ -z "$NEGATIVE" ] && depth=8 || depth=16 - [ -z "$NEGATIVE" ] && resolution=800 || resolution=1600 - scanimage \ - --format=pnm \ - --mode=Color \ - --depth $depth \ - --progress \ - --resolution=$resolution \ - --source="$src" \ - $@ > tmp.ppm -} - -process() { - [ $rotate -eq 0 ] && rotator=cat || rotator="pamflip -rotate$rotate" - [ -z "$NEGATIVE" ] && inverter=cat || inverter=pnminvert - $rotator | pnmcrop -closeness=$crop | $inverter -} - -preview() { - pamdepth 255 < tmp.ppm | pnmscale -w 600 | process > preview.ppm - sxiv preview.ppm -} - -do_next() { - rotate=180 - [ -z "$NEGATIVE" ] && crop=40 || crop=10 - ctr=$(( $ctr + 1 )) - cur=`printf "%03d.ppm" $ctr` -} - -do_next - -while : ; do - echo "$cur: (v)iew r(otate) c(rop) (s)can (p)review (n)ext" - read c - case $c in - v) - scan 150 --preview=yes - preview - ;; - s) - scan 1600 --preview=no --high-quality=yes - preview - ;; - p) - preview - ;; - n) - cat tmp.ppm | process > $cur - do_next - ;; - r) - echo -n "Rotate (n/r/l/t):" - read rotate - case $rotate in - n) rotate=180 ;; - r) rotate=90 ;; - l) rotate=270 ;; - t) rotate=0 ;; - *) echo ? ;; - esac - ;; - c) - echo -n Crop: - read crop - ;; - *) - echo ? - ;; - esac -done