sbs20 / scanservjs

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

Allow to cut off borders #575

Closed CubicrootXYZ closed 1 year ago

CubicrootXYZ commented 1 year ago

Describe the bug

I am using a ScanSnap 1300i. There is no size selection and the scans are always in 219x292 what should be 208x292 (at least the ScanSnap application scans with that size). This results in ugly grey stripes on the left and right side of the scan.

To Reproduce Steps to reproduce the behavior:

  1. Scan a file with the ScanSnap 1300i
  2. Observer thick gray borders

Expected behavior

Some setting to cut off those borders/specify the correct size.

Screenshots

image

Client (please complete the following information):

Server (please complete the following information):

Running the docker official docker image with latest tag.

Logs

Additional context

The logs contain another issue about an undefined process, I will open another ticket for that.

sbs20 commented 1 year ago

Try using afterDevices in your local config and override the following values:

      pageHeight: 292,
      pageWidth: 215.8,

The app will just use the defaults reported by the scanner unless you override them.

CubicrootXYZ commented 1 year ago

@sbs20 thanks for the very quick response. I am not exactly sure how I should set them, I tried the following 2 things:

      device.pageHeigth = 292;
      device.pageWidth = 208;

This results in a scanimage: open of device epjitsu:libusb:001:007 failed: Invalid argument

and

      device.features['--pageHeigth'].default = 292;
      device.features['--pageWidth'].default = 208;

Which results in a TypeError: Cannot set properties of undefined (setting 'default')

Let me know if I am doing it wrong. This is my after scan method as far as it is working:

  afterDevices(devices) {
    /**
     * Example code below
     */
    const device = devices.filter(d => d.id.startsWith('epjitsu'))[0];
    if (device) {
      device.features['--brightness'].default = 60;
      device.features['--contrast'].default = 85;
      device.features['--mode'].default = 'Color';
    }
  },
sbs20 commented 1 year ago

This guess is correct:

      device.features['--pageHeigth'].default = 292;
      device.features['--pageWidth'].default = 208;

But I think you have a typo in height. Should be:

      device.features['--pageHeight'].default = 292;
      device.features['--pageWidth'].default = 208;
CubicrootXYZ commented 1 year ago

Unfortunately even without the typo I am getting the same error message. Tried each of them separate too, same behavior.

sbs20 commented 1 year ago

Sorry - brain fail on my part:

      device.features['--page-height'].default = 292;
      device.features['--page-width'].default = 208;
CubicrootXYZ commented 1 year ago

Thanks, that actually worked. I am really thankful for your time and help to get this up and running properly. Keep up your great work.