Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Bash Batch Scan
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Documentation, Tips & Tricks
View previous topic :: View next topic  
Author Message
szpko
n00b
n00b


Joined: 24 Apr 2014
Posts: 10

PostPosted: Thu Apr 24, 2014 2:12 pm    Post subject: Bash Batch Scan Reply with quote

Bash script : batch scan images at A4 to reasonable sized PDF. Ancient, but still useful. Setup for openbox, imagemagick, ghostscript, thunar and xfce4-terminal : Keybind = [A-s]
Code:

$ sudo nano /usr/local/bin/scan.sh
------
#!/bin/bash

SCANSOUT="<output directory here>"

mkdir /tmp/scan
cd /tmp/scan
scanimage -l 0 -t 0 -x 211 -y 296 --resolution 150 --mode Color --format=pnm --batch --batch-prompt --progress
convert out{1..99}.pnm input.pdf >& /dev/null
gs -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -sOutputFile=output.pdf input.pdf >& /dev/null
mv output.pdf  $SCANSOUT/`date +%s`.pdf
rm -Rf /tmp/scan
thunar $SCANSOUT
------
$ sudo chmod +x /usr/local/bin/scan.sh
$ nano ~/.config/openbox/rc.xml
------
<keyboard
 <keybind key="A-s"><action name="Execute"><command>xfce4-terminal --title="Scanning" --geometry="100x25" -e scan.sh</command></action></keybind>
</keyboard>
------

_________________
μινιμαλισμός
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Documentation, Tips & Tricks All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum