sbs20 / scanservjs

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

Preview ignores Width and Height constraints #716

Open diresi opened 4 months ago

diresi commented 4 months ago

The Preview command ignores width/height constraints and uses defaults instead, which cause my Epson Expression Home XP-342 to abort with

scanimage: sane_start: Operation was canceled

To Reproduce Steps to reproduce the behavior:

  1. Go to 'Scan'
  2. Edit Width and Height and set some non-defaults
  3. Click on 'Preview'
  4. Check server logs for actual "scanimage" command line, here it reports ... -x 218.4 -y 299.7 ... regardless of Width and Height settings in the UI:
    spawn: '/usr/bin/scanimage -d utsushi:esci:usb:04b8:1115 --mode Color --resolution 100 -l 0 -t 0 -x 218.4 -y 299.7 --format tiff --brightness 0 --contrast 0 -o data/preview/preview.tif

Expected behavior Use width and height as provided in UI.

Client (please complete the following information):

Server (please complete the following information):

Logs

 [2024-02-26T19:55:20.026Z] INFO (Process): {
  spawn: '/usr/bin/scanimage -d utsushi:esci:usb:04b8:1115 --mode Color --resolution 100 -l 0 -t 0 -x 218.4 -y 299.7 --format tiff --brightness 0 --contrast 0 -o data/preview/preview.tif'
}
[2024-02-26T19:55:20.957Z] INFO (Http): { method: 'GET', path: '/api/v1/preview' }
[2024-02-26T19:55:20.960Z] INFO (Process): { spawn: 'convert - -resize 868x1191! jpg:-' }
[2024-02-26T19:55:21.955Z] INFO (Http): { method: 'GET', path: '/api/v1/preview' }
[2024-02-26T19:55:21.958Z] INFO (Process): { spawn: 'convert - -resize 868x1191! jpg:-' }
[2024-02-26T19:55:22.073Z] ERROR (Http): Error: /usr/bin/scanimage -d utsushi:esci:usb:04b8:1115 --mode Color --resolution 100 -l 0 -t 0 -x 218.4 -y 299.7 --format tiff --brightness 0 --contrast 0 -o data/preview/preview.tif exited with code: 2, stderr: scanimage: sane_start: Operation was canceled
    at ChildProcess.<anonymous> (/usr/share/webapps/scanservjs/server/classes/process.js:85:18)
    at ChildProcess.emit (node:events:519:28) 
    at maybeClose (node:internal/child_process:1105:16)
    at ChildProcess._handle.onexit (node:internal/child_process:305:5)
diresi commented 4 months ago

717 works for me, but it's mostly used to demonstrate my problem.