2 # scan_stuff scans papers
3 # and is released under the terms of the GNU GPL version 3, or any
4 # later version, at your option. See the file README and COPYING for
6 # Copyright 2014 by Don Armstrong <don@donarmstrong.com>.
17 scan_stuff - scans papers
24 --simplex single sided
25 --duplex double sided (Default)
26 --mode Scanning mode (Color,Gray,Lineart)
27 --debug, -d debugging level (Default 0)
28 --help, -h display this help
29 --man, -m display manual
37 Single sided documents
41 Double sided documents (default)
45 Scanning mode; passed directly to scanimage. Useful options are
46 C<Gray> (Default), C<Color>, and C<Lineart>.
50 Debug verbosity. (Default 0)
54 Display brief usage information.
64 scan_stuff; # repeat as necessary
65 scantailor-cli -l 1 --content-detection=cautious *.tif -o out;
73 my %options = (device => 'fujitsu',
84 'debug|d+','help|h|?','man|m');
86 pod2usage() if $options{help};
87 pod2usage({verbose=>2}) if $options{man};
89 $DEBUG = $options{debug};
93 if (exists $options{duplex} and exists $options{simplex} and
94 not ($options{duplex} xor $options{simplex})) {
95 push @USAGE_ERRORS,"Conflicting --duplex and --simplex options given";
98 pod2usage(join("\n",@USAGE_ERRORS)) if @USAGE_ERRORS;
101 if ((exists $options{duplex} and not $options{duplex}) or
102 (exists $options{simplex} and $options{simplex})) {
114 find(sub { return if /^\./;
115 $File::Find::prune = 1 if -d $_;
117 $last_num = $1 if $1 > $last_num;
124 exec('scanimage','-d',$options{device},
125 '--source',$use_duplex?'ADF Duplex':'ADF Front','--mode',$options{mode},'--format','tiff',
126 '--batch=out_'.sprintf('%03d',$last_num).'_%03d.tif');