eresturo / scanadf2docspell

A script to scan from ADF, preprocess and upload to Docspell.
GNU General Public License v3.0
13 stars 0 forks source link

For Duplex scan we need "--adf-mode" parameter instead of changing source #33

Closed marrobHD closed 2 years ago

marrobHD commented 2 years ago

Here is mine (Epson XP 860);

Parameters are separated by a blank from single-character options (e.g.
-d epson) and by a "=" from multi-character options (e.g. --device-name=epson).
-d, --device-name=DEVICE   use a given scanner device (e.g. hp:/dev/scanner)
    --format=pnm|tiff|png|jpeg|pdf  file format of output file
-i, --icc-profile=PROFILE  include this ICC profile into TIFF file
-L, --list-devices         show available scanner devices
-f, --formatted-device-list=FORMAT similar to -L, but the FORMAT of the output
                           can be specified: %d (device name), %v (vendor),
                           %m (model), %t (type), %i (index number), and
                           %n (newline)
-b, --batch[=FORMAT]       working in batch mode, FORMAT is `out%d.pnm' `out%d.tif'
                           `out%d.png' or `out%d.jpg' by default depending on --format
                           This option is incompatible with --output-file.    --batch-start=#        page number to start naming files with
    --batch-count=#        how many pages to scan in batch mode
    --batch-increment=#    increase page number in filename by #
    --batch-double         increment page number by two, same as
                           --batch-increment=2
    --batch-print          print image filenames to stdout
    --batch-prompt         ask for pressing a key before scanning a page
    --accept-md5-only      only accept authorization requests using md5
-p, --progress             print progress messages
-o, --output-file=PATH     save output to the given file instead of stdout.
                           This option is incompatible with --batch.
-n, --dont-scan            only set options, don't actually scan
-T, --test                 test backend thoroughly
-A, --all-options          list all available backend options
-h, --help                 display this help message and exit
-v, --verbose              give even more status messages
-B, --buffer-size=#        change input buffer size (in kB, default 32)
-V, --version              print version information
Output format is not set, using pnm as a default.

Options specific to device `epson2':
  Scan Mode:
    --mode Lineart|Gray|Color [Lineart]
        Selects the scan mode (e.g., lineart, monochrome, or color).
    --depth 8bit [inactive]
        Number of bits per sample, typical values are 1 for "line-art" and 8
        for multibit scans.
    --halftoning None|Halftone A (Hard Tone)|Halftone B (Soft Tone)|Halftone C (Net Screen)|Dither A (4x4 Bayer)|Dither B (4x4 Spiral)|Dither C (4x4 Net Screen)|Dither D (8x4 Net Screen)|Text Enhanced Technology|Download pattern A|Download pattern B [inactive]
        Selects the halftone.
    --dropout None|Red|Green|Blue [None] [advanced]
        Selects the dropout.
    --brightness 0..0 [inactive]
        Selects the brightness.
    --sharpness -2..2 [inactive]

    --gamma-correction User defined (Gamma=1.0)|User defined (Gamma=1.8) [User defined (Gamma=1.8)]
        Selects the gamma correction value from a list of pre-defined devices
        or the user defined table, which can be downloaded to the scanner
    --color-correction None|Built in CCT profile|User defined CCT profile [inactive]
        Sets the color correction table for the selected output device.
    --resolution 75|300|1200|2400|4800dpi [75]
        Sets the resolution of the scanned image.
    --threshold 0..255 [128]
        Select minimum-brightness to get a white point
  Advanced:
    --mirror[=(yes|no)] [inactive]
        Mirror the image.
    --auto-area-segmentation[=(yes|no)] [inactive]
        Enables different dithering modes in image and text areas
    --red-gamma-table 0..255,...
        Gamma-correction table for the red band.
    --green-gamma-table 0..255,...
        Gamma-correction table for the green band.
    --blue-gamma-table 0..255,...
        Gamma-correction table for the blue band.
    --wait-for-button[=(yes|no)] [no] [advanced]
        After sending the scan command, wait until the button on the scanner
        is pressed to actually start the scan process.
  Color correction:
    --cct-type Automatic|Reflective|Colour negatives|Monochrome negatives|Colour positives [inactive]
        Color correction profile type
    --cct-profile -2..2,... [advanced]
        Color correction profile data
  Preview:
    --preview[=(yes|no)] [no]
        Request a preview-quality scan.
  Geometry:
    -l 0..215.9mm [0]
        Top-left x position of scan area.
    -t 0..297.18mm [0]
        Top-left y position of scan area.
    -x 0..215.9mm [215.9]
        Width of scan-area.
    -y 0..297.18mm [297.18]
        Height of scan-area.
  Focus:
    --autofocus[=(yes|no)] [inactive]
        Perform autofocus before scan
    --focus 0..254 [inactive]
        Focus position for manual focus
  Optional equipment:
    --source Flatbed|Automatic Document Feeder [Flatbed]
        Selects the scan source (such as a document-feeder).
    --auto-eject[=(yes|no)] [no]
        Eject document after scanning
    --film-type Positive Film|Negative Film|Positive Slide|Negative Slide [inactive]

    --bay 1|2|3|4|5|6 [inactive]
        Select bay to scan
    --eject []
        Eject the sheet in the ADF
    --adf-mode Simplex|Duplex [Simplex]
        Selects the ADF mode (simplex/duplex)
sonarcloud[bot] commented 2 years ago

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

eresturo commented 2 years ago

ok, i will merge this now, since i want to support hp and epson scanners, of course :slightly_smiling_face:

i will try to find a somehow "nice" option to let users configure both scanners (and probably others)

marrobHD commented 2 years ago

@eresturo Maybe we should add manufacturer specific parameters for scanimage in the script which then can be manually called via manufacturer=epson | hp | canon [auto identify manufacturer, defaults to hp] parameter for scan.py.

Scanimage seems to use the first device that appears via scanimage -L by default:

scanimage -L | head -n 1
device `epson2:libusb:001:010' is a Epson PID 08C6 flatbed scanner

So we could prioritize the manually specified scanning device (--device DEVICE) and default to the first line output of scanimage -L.

Edit: I thought way too complicated.

eresturo commented 2 years ago

sorry i missed your proposal here before implementing the "command config".

you are right, one could do somehow automatically. We could scan sane's documentation to be compatible with every scanner, but i am too lazy :laughing:

It's a command line tool, so propably only nerds are using it... They will figure it out, i guess.