Skip to content

Instantly share code, notes, and snippets.

@luclu7
Created February 12, 2019 01:21
Show Gist options
  • Save luclu7/b24d0a3283a00937cb537a34b73afdc8 to your computer and use it in GitHub Desktop.
Save luclu7/b24d0a3283a00937cb537a34b73afdc8 to your computer and use it in GitHub Desktop.
Useful script for a fast scan on *nix (needs Imagemagick and sane)
#!/bin/sh
echo "Start time :"
date
target_name=$(date '+%Y-%m-%d_%H-%M-%S')
folderroot=/mnt/scans
folder=$folderroot/$(date +%Y/%m/%d)
fullpath=$folder/$target_name.ppm
finalpath=$folder/$target_name.png
scanimage_options="--mode color --resolution 150"
mkdir -p $folder
echo "Scanning..."
scanimage $scanimage_options > $fullpath
cd $folder
echo "Conversion of $fullpath to png"
convert -quality 100 "$fullpath" "$finalpath"
rm "$fullpath"
echo "End time :"
date
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment