Skip to content

Instantly share code, notes, and snippets.

@morbidick
Last active October 13, 2015 16:41
Show Gist options
  • Save morbidick/11195604 to your computer and use it in GitHub Desktop.
Save morbidick/11195604 to your computer and use it in GitHub Desktop.
#!/bin/sh
outname=$1
startdir=$(pwd)
timestamp=$(date +"%s")
tmpdir="scan-$timestamp"
cd /tmp
mkdir $tmpdir
cd $tmpdir
echo "################## Scanning ###################"
#mode can be Lineart, Gray or Color
scanimage --batch=out%d.tif --batch-prompt --format=tiff --mode Gray --resolution 300
echo "############## Converting to PDF ##############"
#Use tiffcp to combine output tiffs to a single mult-page tiff
tiffcp -c lzw out*.tif output.tif
#Convert the tiff to PDF
tiff2pdf -j -o $startdir/$outname output.tif
echo "################ Cleaning Up ################"
cd ..
rm -rf $tmpdir
cd $startdir
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment