X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=scan_stuff;h=1b34df9e045735d323aa9493b5d205718101a80d;hb=090779c26defdd9d548378706d1e26e3396f3445;hp=b556d962c65cb5220ad39872c97e51af4df8adff;hpb=4f2fadd407b340c60506172e7720d1bdb7cfb9a9;p=bin.git diff --git a/scan_stuff b/scan_stuff index b556d96..1b34df9 100755 --- a/scan_stuff +++ b/scan_stuff @@ -21,6 +21,9 @@ scan_stuff - scans papers scan_stuff [options] Options: + --simplex single sided + --duplex double sided (Default) + --mode Scanning mode (Color,Gray,Lineart) --debug, -d debugging level (Default 0) --help, -h display this help --man, -m display manual @@ -29,6 +32,19 @@ scan_stuff [options] =over +=item B<--simplex> + +Single sided documents + +=item B<--duplex> + +Double sided documents (default) + +=item B<--mode> + +Scanning mode; passed directly to scanimage. Useful options are +C (Default), C, and C. + =item B<--debug, -d> Debug verbosity. (Default 0) @@ -45,7 +61,9 @@ Display this manual. =head1 EXAMPLES -scan_stuff + scan_stuff; # repeat as necessary + scantailor-cli -l 1 --content-detection=cautious *.tif -o out; + make_djvu =cut @@ -56,9 +74,13 @@ my %options = (device => 'fujitsu', debug => 0, help => 0, man => 0, + mode => 'Gray' ); GetOptions(\%options, + 'duplex!', + 'simplex!', + 'mode=s', 'debug|d+','help|h|?','man|m'); pod2usage() if $options{help}; @@ -67,13 +89,21 @@ pod2usage({verbose=>2}) if $options{man}; $DEBUG = $options{debug}; my @USAGE_ERRORS; -# if (1) { -# push @USAGE_ERRORS,"You must pass something"; -# } +my $use_duplex = 1; +if (exists $options{duplex} and exists $options{simplex} and + not ($options{duplex} xor $options{simplex})) { + push @USAGE_ERRORS,"Conflicting --duplex and --simplex options given"; +} pod2usage(join("\n",@USAGE_ERRORS)) if @USAGE_ERRORS; +if ((exists $options{duplex} and not $options{duplex}) or + (exists $options{simplex} and $options{simplex})) { + $use_duplex = 0; +} + + use File::Find; if (@ARGV) { @@ -92,8 +122,8 @@ find(sub { return if /^\./; $last_num++; exec('scanimage','-d',$options{device}, - '--source','ADF Duplex','--mode','Gray','--format','tiff', - '--batch','out_'.sprintf('%03d',$lastnum).'_%03d.tif'); + '--source',$use_duplex?'ADF Duplex':'ADF Front','--mode',$options{mode},'--format','tiff', + '--batch=out_'.sprintf('%03d',$last_num).'_%03d.tif'); __END__