]> Sergey Matveev's repositories - dotfiles.git/blobdiff - bin/bin/scan.sh
start-x-hidpi
[dotfiles.git] / bin / bin / scan.sh
diff --git a/bin/bin/scan.sh b/bin/bin/scan.sh
deleted file mode 100755 (executable)
index f7723c9..0000000
+++ /dev/null
@@ -1,85 +0,0 @@
-#!/bin/sh
-
-rotate=0
-crop=0
-cur=noname.ppm
-ctr=${1:-1}
-ctr=$(( $ctr - 1 ))
-
-[ -z "$NEGATIVE" ] && SRC="Flatbed" || SRC="Transparency Adapter"
-
-scan() {
-    resolution=$1
-    shift
-    scanimage --format=pnm --mode=Color --depth 16 --progress --resolution=$resolution --source="$SRC" $@ > tmp.ppm
-}
-
-process() {
-    [ $rotate -eq 0 ] && rotator=cat || rotator="pamflip -rotate$rotate"
-    $rotator | pnmcrop -closeness=$crop
-}
-
-preview() {
-    [ -z "$NEGATIVE" ] && inverter=cat || inverter=pnminvert
-    pamdepth 8 < tmp.ppm | pnmscale -w 600 | process | $inverter > preview.ppm
-    sxiv preview.ppm
-}
-
-do_next() {
-    rotate=180
-    [ -z "$NEGATIVE" ] && crop=50 || 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:
-        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