e-alfred / nextcloud-scanner

Scanner app for Nextcloud using the SANE framework
GNU Affero General Public License v3.0
23 stars 10 forks source link

Scanner modes mapping #22

Open sapo33 opened 4 years ago

sapo33 commented 4 years ago

When scanning with a Samsung C460 Series, resulting jpg file has a null size. Investigating a bit shows that the scanner doesn't consider "Color" / "Gray" / "Lineart" as acceptable modes and has its own labels instead.

It would be great if we could configure an additionnal abstract list (key/value) to map scanner modes, ie: modes["Color"]="Color - 16 Million Colors" modes["Gray"] = "Grayscale - 256 Levels" modes["Lineart"] = "Black and White - Line Art"

Values could be imported via include in ScannerStorage.php

A last word to mention how happy I am to use your Nextcloud Scanner implementation and to thank you for that.

Biont commented 4 years ago

@sapo33 If you can, maybe check out the vuejs-rework branch (see #12) which attempts to gather the available scan parameters directly from the back-end. It could be that it works for you, even though the implementation is still very much WIP

Kunzol commented 3 years ago

On my brother MFC-L2710 the modes shown are:

scanimage --device "brother4:net1;dev0" -A
...
--mode Black & White|Gray[Error Diffusion]|True Gray|24bit Color[Fast] [24bit Color[Fast]]
...

as far as I understood the scanimage manual, only the first characters are needed:

For convenience,  it is legal to abbreviate the string values as long as they remain unique.  
Also, the case of the spelling doesn't matter.  For example, option setting --mode col is identical to --mode Color.

In my case it worked with black, true, 24bit (I left out the "Error Diffusion").

The ideal case would be to parse the output of scanimage. But it takes quiet some time till the output shows up. Ether once on install or somewhere in the settings would be better. I am not sure about my Nextcloud-App-Programming skills. Maybe I try something.