Home
Name Modified Size InfoDownloads / Week
scan.sh 2025-09-01 37.9 kB
create_pdf_from_jpgs_imagemagick.sh 2025-09-01 24.4 kB
readme.md 2025-08-29 3.8 kB
Totals: 3 Items   66.0 kB 0

scan.sh - A Script for Scanning, Processing, and Saving Documents

scan.sh is a versatile Bash script designed to automate your document scanning workflow. It handles everything from capturing the image to processing and saving it in an organized way. The script supports various scanning modes, image formats, and offers multiple options for both simple and complex scanning tasks.

Features

  • Scanning Modes: Choose between color, gray, or lineart for your scans.
  • Customizable Settings: Adjust DPI resolution and compression quality to meet your needs.
  • Defined Scan Area: The script allows you to specify a custom scan area in millimeters, with a default for A4 size.
  • Automatic Image Processing: The script automatically sharpens and resizes the scanned image to a target resolution, optimizing file size and quality.
  • Multiple Output Formats: Save your files as jpg (default), png, pdf, or tiff.
  • Organized File Naming: Files are automatically named with the current date, a sequential number, and an optional custom description.
  • Serial Scanning (serial): A mode that lets you scan multiple documents in a row, with the option to edit parameters after each scan.
  • Graphical Interface (gui): Launches a graphical window to set parameters before scanning, which automatically enables serial mode.
  • Translation Option (translate): Opens the scanned image in an image viewer and simultaneously opens Google Translate Images in your browser, making it easy to drag-and-drop the file for manual translation.

Installation

  1. Save the script code to a file, for example, ~/bin/scan.sh.
  2. Give the file execute permissions: bash chmod +x ~/bin/scan.sh
  3. Ensure the ~/bin/ directory is in your $PATH variable so you can run the script from anywhere.

Dependencies

The script requires the following packages to function:

  • sane-utils (for the scanimage command)
  • ImageMagick (for the convert and mogrify commands)
  • kdialog (for displaying notifications)
  • gwenview (or another image viewer like xdg-open)
  • xdg-utils (for xdg-open, required for the translate option)

Example installation commands for common Linux distributions:

  • Debian/Ubuntu: bash sudo apt update && sudo apt install sane-utils imagemagick kdialog gwenview xdg-utils
  • Arch Linux: bash sudo pacman -Sy sane-utils imagemagick kdialog gwenview xdg-utils
  • openSUSE: bash sudo zypper refresh && sudo zypper install ImageMagick sane-utils kdialog gwenview xdg-utils

Usage

Basic Syntax

./scan.sh [OPTION=VALUE] [...] [FLAG] [...]

--###------------------------ Short_help -----------------------

Usage: scan.sh [OPTION=VALUE] [...] [FLAG] [...]

(e.g., scan.sh mode=color - scans in color)

(e.g., scan.sh fast - scans in fast mode)

OPTIONS:

mode=[color|gray|lineart] - Scanning mode.

dpi=[number] - Scanning resolution in DPI.

area=[x:y:w:h] - Scanning area in mm.

resize=[width]x[height] - Target image dimensions.

format=[jpg|png|pdf|tiff] - Output file format.

quality=[0-100] - Compression quality.

description=[text] - Adds a description to the filename.

translate=[lang_code] - Opens Google Translate Images for translation.

FLAGS:

fast - Enables fast scanning mode.

serial - Allows multiple scans with parameter editing.

gui - Runs in graphical mode.

For full information, including installation and dependencies, use:

scan.sh --help

-###------------------ End Short_help ------------------------------------

Source: readme.md, updated 2025-08-29