|
|
@@ -27,14 +27,14 @@ export -f check_filename # Make available to run_scan's command substitution
|
|
|
# Run scanner. arguments: 1-folder 2-prefix 3-timestamp 4-format 5-papersize 6-resolution 7-colormode
|
|
|
function run_scan {
|
|
|
|
|
|
- # Paper size.
|
|
|
+ # Paper sizes.
|
|
|
landscape=false
|
|
|
case $5 in
|
|
|
A4)
|
|
|
x=210
|
|
|
y=297
|
|
|
;;
|
|
|
- A4R)
|
|
|
+ A4-R)
|
|
|
x=210
|
|
|
y=297
|
|
|
landscape=true
|
|
|
@@ -43,7 +43,7 @@ function run_scan {
|
|
|
x=148
|
|
|
y=210
|
|
|
;;
|
|
|
- A5R)
|
|
|
+ A5-R)
|
|
|
if [[ $6 == "150" ]] then
|
|
|
# Force A4 instead, and cut later.
|
|
|
# Sane epson backend throws an out of memory error at ~A5R 150DPI.
|
|
|
@@ -53,16 +53,30 @@ function run_scan {
|
|
|
x=210
|
|
|
y=148
|
|
|
;;
|
|
|
+ LTR)
|
|
|
+ x=216
|
|
|
+ y=279
|
|
|
+ ;;
|
|
|
+ LTR-R)
|
|
|
+ x=216
|
|
|
+ y=279
|
|
|
+ landscape=true
|
|
|
+ ;;
|
|
|
+ B5)
|
|
|
+ x=176
|
|
|
+ y=250
|
|
|
+ ;;
|
|
|
esac
|
|
|
|
|
|
filename=$1/$2-$(date +"%Y-%m-%d-%H%M%S").$4
|
|
|
filename=$(check_filename $filename)
|
|
|
+ tempname="./temp-$(date +%s).png"
|
|
|
|
|
|
echo "$7 $6 $x $y $filename"
|
|
|
|
|
|
- tempname="./temp-$(date +%s).png"
|
|
|
scanimage --mode=$7 --resolution=$6 -x $x -y $y --format=png --output-file=$tempname | \
|
|
|
yad --progress --text="Scanning to PNG..." --width=300 --no-buttons --auto-close
|
|
|
+
|
|
|
if [[ $landscape == true ]] then
|
|
|
convert $tempname -rotate 90 $tempname | \
|
|
|
yad --progress --text="Rotating to Landscape" --width=300 --no-buttons --auto-close
|
|
|
@@ -91,6 +105,7 @@ function run_scan {
|
|
|
|
|
|
size_raw=$(stat -c%s $filename)
|
|
|
size_kb=$((size_raw/1024))
|
|
|
+
|
|
|
yad --picture --title="Filesize: $size_kb KB ($4)" --size=fit --width=750 --height=1000 --filename=$tempname
|
|
|
rm $tempname
|
|
|
}
|
|
|
@@ -103,7 +118,7 @@ yad --form --orient=hor --maximized --width=750 --height=250 --columns=3 \
|
|
|
--field="Filename Prefix:SFL" scan \
|
|
|
--field="Timestamp:CB" Yes\!No \
|
|
|
--field="File format:CB" jpg\!png\!pdf \
|
|
|
- --field="Paper Size:CB" A4\!A4R\!A5\!A5R \
|
|
|
+ --field="Paper Size:CB" A4\!A4-R\!A5\!A5-R\!LTR\!LTR-R\!B5\! \
|
|
|
--field="Resolution (DPI):CB" 75\!150\!^300\!600\!1200 \
|
|
|
--field="Scan Buttons:BTN" "" \
|
|
|
--field="Colour:FBTN" 'bash -c "run_scan %1 %2 %3 %4 %5 %6 Color"' \
|