Skip to content

Instantly share code, notes, and snippets.

@j4velin
Created September 19, 2020 16:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save j4velin/a32f2fd355f5140538586f19d780d6cc to your computer and use it in GitHub Desktop.
Save j4velin/a32f2fd355f5140538586f19d780d6cc to your computer and use it in GitHub Desktop.
Scans the given number of pages and moves the resulting pdf to the input directory for the ocr.sh script
#/bin/bash
count=$1
resolution=150
cd /home/pi/scans
if [ $count -gt 1 ]
then
scanimage --batch=scan_%d.tiff --batch-count=$count --format=tiff --resolution $resolution --mode Gray
tiffcp scan_* scan.tiff
rm scan_*
else
scanimage --format=tiff --resolution $resolution --mode Gray >scan.tiff
fi
tiff2pdf -p A4 scan.tiff > scan.pdf
rm scan.tiff
mv scan.pdf ../scaninput/scan_$(date +'%d_%m_%y_%H_%M_%S').pdf
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment