Closed ad3m3r5 closed 2 years ago
Hi. Thanks for reporting. Are you able to share the log please?
Also, what happens if you manually run:
/usr/bin/scanimage -d 'airscan:w0:Dell C1765nf Color MFP' --mode 'Color' --source 'Flatbed' --resolution 100 -l 0 -t 0 -x 215.9 -y 296.9 --format 'tiff' --brightness 0 --contrast 0 > test.tif
Can you share the file it generates? (So just an empty scan is fine)
Yep. After reverting my changes on my Pi, the preview is now not erroring, but it also doesn't produce an image. So it's still broken.
GitHub is erroring when trying to share the file - "We don't support that file type". I changed the extension to .txt
for it to allow me to upload it.
[test.txt removed]
Weird. Looks like this: https://github.com/alexpevzner/sane-airscan/issues/164
The "TIF"/stdout contains log output.
I've removed the logs before and after the BLOB, saved, and can see the windows test page.
Interesting.... On that note though, would it be better to just go ahead and use -o
instead of a redirect? It seems more robust rather than relying on stdout to be perfect across all scanners/printers.
Also - I'm going to remove the above test "image" since you have it now
Describe the bug
I was not able to get scanning working over USB, while printing does. So, I configured airscan to work with the scanning portion of the printer. Using the scanner over the command line works completely fine. However, an error occurs when trying to scan or get a preview using scanservjs.
Configuration:
scanimage -L Output:
device 'airscan:w0:Dell C1765nf Color MFP' is a WSD Dell C1765nf Color MFP ip=[removed]
Scanservjs errors:
Preview: Mar 23 11:10:04 [hostname] server.js[38682]: [2022-03-23T15:10:04.446Z] ERROR (Http): Error: /usr/bin/scanimage -d 'airscan:w0:Dell C1765nf Color MFP' --mode 'Color' --source 'Flatbed' --resolution 100 -l 0 -t 0 -x 215.9 -y 296.9 --format 'tiff' --brightness 0 --contrast 0 > data/temp/~tmp-scan-0-0001.tif > data/preview/preview.tif exited with code: 1, stderr: scanimage: open of device airscan:w0:Dell C1765nf Color MFP failed: Invalid argument
Scan: Mar 23 11:30:44 TheWholePi server.js[39971]: [2022-03-23T15:30:44.488Z] ERROR (Http): Error: /usr/bin/convert 'data/temp/~tmp-scan-0-0001.tif' -scale 868 -background '#808080' -extent '868x1194-0-0' 'data/preview/preview.tif' exited with code: 1, stderr: convert: Not a TIFF or MDI file, bad magic number 20545 (0x5041). `data/temp/~tmp-scan-0-0001.tif' @ error/tiff.c/TIFFErrors/606.
What I believe is happening
I believe the stdout for the
scanimage
command is not the actual file itself, so a "redirect" (>) does not work, at least for this printer. Therefore, thescanimage
command built inscanimage.js
is just saving text output fromscanimage
as an image file, such as preview.tif.Proposed Solution:
I did some testing with the
-o
flag forscanimage
, and I believe I found a solution. With some minimal changes inscanimage.js
,api.js
, andrequest.js
, I was able to switch toscanimage
using the output flag, rather than a stdout redirect. I'll open a PR to reflect these changes.