sbs20 / scanservjs

SANE scanner nodejs web ui
https://sbs20.github.io/scanservjs/
GNU General Public License v2.0
768 stars 146 forks source link

incorrect resolution detection at Panasonic MB1500 #739

Open rma945 opened 2 months ago

rma945 commented 2 months ago

Describe the bug scanservjs can't parse --resolution parameter from scanimage output, becuase it don't contains expected regexp.

scanservsjs expects that all parameters from scanimage can be matched by this regexp but --resolution 75|100|150|200|300|400|600|1200dpi,... has a different format. Also, asResolution() function will do incorrect resolution options parse, becuase of non expected format of resolution parameters string. Because --resolution - is a mandatory parameter - scanservjs can't find scanner and resolution options can't be overrided by default config. I guess that as a workaround - we can add option for define a manual values for scanners if output from scanimage can't be parsed

scanimage output:

Output format is not set, using pnm as a default.

All options specific to device `panamfs:libusb:001:002':
    --preview[=(yes|no)] [no]
        Request a preview-quality scan.
    --mode Black and White|Grayscale|Color [Color]
        "Black and White" is for documents containing only text or line art.
        "Grayscale" is for documents containing photographs. "Color" is for
        document containing color image (color scan models only).
    --resolution 75|100|150|200|300|400|600|1200dpi,...
        Select a resolution of your document.
    --paper-size A4|Letter|B5(ISO)|B5(JIS)|16K|User Define [Letter]
        Select a Scan Size that corresponds to the size of your original
        document.
    -l 0..215.9mm [0.998215]
        Top-left x position of scan area.
    -t 0..297mm [0.998215]
        Top-left y position of scan area.
    -x 0..214.902mm [213.904]
        Width of scan-area.
    -y 0..296.001mm [277.404]
        Height of scan-area.
    --brightness 1..5 (in steps of 1) [3]
        The balance of light and dark colors in an image.
    --contrast 1..5 (in steps of 1) [3]
        The relative difference between the dark and light portions of an
        image.

Expected behavior A clear and concise description of what you expected to happen.

Logs

NodeJS version

v18.19.0

OS version

Armbian 24.11.0-trunk.141 bookworm"