SimulPiscator / AirSane

Publish SANE scanners to MacOS, Android, and Windows via Apple AirScan.
GNU General Public License v3.0
243 stars 26 forks source link

Broken grayscale scanning #85

Closed itsmevjnk closed 2 years ago

itsmevjnk commented 2 years ago

I'm using AirSane with my Canon MF221d, and it seems that it can do color scanning well but not grayscale. When I tried scanning in grayscale using AirSane's built-in eSCL frontend or other 3rd party software (such as Mopria Scan or VueScan) it would just generate 0-byte/corrupted files. Interestingly, this line can also be seen in the service status log:

May 24 10:22:46 hydra airsaned[5638]: /home/itsmevjnk/AirSane/server/scanjob.cpp, line 656: encoder bytesPerLine (2480) differs from SANE bytes_per_line (7440)
May 24 10:22:47 hydra airsaned[5638]: JpegEncoder: bit depth unsupported, aborting

To make sure that the driver isn't the culprit, I've also tried running scanimage in grayscale mode, and it still gives me proper TIFF file. Have I configured something incorrectly, or is this an actual bug?

SimulPiscator commented 2 years ago

Looks like a bug, but I cannot reproduce it. Can you run AirSane in debug mode (see README.md for details), and post the full output? Thanks!

itsmevjnk commented 2 years ago

Here's the debug log: airscan.txt For reference, lines 32-70 are generated during a (failed) grayscale scan, and lines 78-116 are generated during a color scan. Anyways, a workaround that I've found is to enable synthesize-gray, but considering that the synthesized gray may not exactly match the actual shade, I think this bug should be resolved.

SimulPiscator commented 2 years ago

It seems that your backend resets the Color option when setting the Source option. I've reordered setting those options to make such interference less likely. Could you try the latest git version and report whether it works for you now? Thanks!

itsmevjnk commented 2 years ago

It works flawlessly now. Thanks for the speedy fix!

SimulPiscator commented 2 years ago

Thanks for the report.