Advertisement
metalx1000

scanner script

May 25th, 2022
817
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #!/bin/bash
  2. ######################################################################
  3. #Copyright (C) 2022  Kris Occhipinti
  4. #https://filmsbykris.com
  5.  
  6. #This program is free software: you can redistribute it and/or modify
  7. #it under the terms of the GNU General Public License as published by
  8. #the Free Software Foundation, either version 3 of the License, or
  9. #(at your option) any later version.
  10.  
  11. #This program is distributed in the hope that it will be useful,
  12. #but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. #MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  14. #GNU General Public License for more details.
  15.  
  16. #You should have received a copy of the GNU General Public License
  17. #along with this program.  If not, see <http://www.gnu.org/licenses/>.
  18. ######################################################################
  19. #set -e
  20. DEV="escl:https://192.168.1.170:443"
  21. DIR=`mktemp -d`
  22. CUR=$PWD
  23.  
  24. cd $DIR
  25. echo "$DIR"
  26.  
  27. if [[ "$1" ]]
  28. then
  29.   FILE="$1"
  30. else
  31.   read -p "File Name: " FILE
  32. fi
  33.  
  34. [[ "$FILE" ]] || exit 1
  35.  
  36. [[ "$FILE" != *".pdf" ]] && FILE="${FILE}.pdf"
  37.  
  38. REZ="$(echo -e "150\n200\n300"|fzf --prompt="Resolution")"
  39.  
  40. [[ "$REZ" ]] || exit 1
  41.  
  42.  
  43. while [ 1 ]
  44. do
  45.   scanimage --format png -d "$DEV" --output-file "$(date +%s).png" --resolution $REZ
  46.   c="$(echo -e "Continue\nQUIT"|fzf)"
  47.   [[ "$c" != "Continue" ]] && break
  48. done
  49.  
  50. convert *.png "$CUR/$FILE"
  51. opd "$CUR/$FILE"
  52. open "$CUR/$FILE"
  53.  
Advertisement
RAW Paste Data Copied
Advertisement