Home › Forums › TWAIN Classic › How to set scanner to scan document in grayscale-photo?
- This topic has 4 replies, 2 voices, and was last updated 11 years, 2 months ago by spike.
- AuthorPosts
Hello Folks,
We have an application that scans documents to be used later on.
Our only client uses AVISION Sheetfed Scanner AV220D2+ and AV220C2+.
Our current problem is that some documents become either too white or black after being scanned.
Considering that scanner configuration may be changed by users and/or other applications, I was wondering if we could reset its configuration to better serve our application.
I noticed that we can get better results if these documents are scanned in grayscale where its type is PHOTO.
We develop in C# and use Accusoft components to process the scanned documents. How can I change our application to setup the scanner as I mentioned above?
Any help or suggestions are welcome!
Thanks in advance!
Douglas.Hi douglasmota – I don’t know (or equivalently, don’t remember) how to do that through Accusoft, but I can give a hint: Look for a TWAIN-related function that sets the ‘pixeltype’. The exact TWAIN parameter is called ICAP_PIXELTYPE. You want to set it to TWPT_GRAY, which will tell the scanner to scan in 8-bit grayscale.
You may also want to set the TWAIN parameters ICAP_CONTRAST and ICAP_BRIGHTNESS (for example, to 0) if you want to have more consistency. These two parameters could be set by users in other applications, and could affect the gray levels of your scans.
Doing the thresholding to B&W from grayscale in software can be very effective – it allows a choice of algorithms, from fast-but-dumb to quite clever – Accusoft’s toolkit probably has several, perhaps with tunable parameters. The downside is that many scanners scan more slowly in grayscale mode, and for higher resolution the transfer of data from scanner to PC over USB can become a bottleneck.
Hi spike,
Thanks a lot for your reply! I am going to pass this information to my colleague to see if he can get some good results!
I’ll let you know about our findings.
Hi spike and all,
We did manage to set the scanner to use the grayscale.
But when testing, we noticed that we got the best results where Document Type is “Photo”. The options are: Document, Photo, and Normal (as you can see from attached image).
Our challenge is to set the “Photo” option, since the “Document” option is the default.
Anyways, any help is much appreciated!
Thanks in advance!
Douglas.I think I’ve seen that driver UI somewhere else! Avision makes quite a few scanners for other brands, I believe…
I believe that setting, Document vs Photo vs Normal, is going to be a proprietary or ‘custom’ capability.
Assuming that Avision makes it available at all. But, they seem to offer lots of custom capabilities so I’m optimistic.The problem is that, unless you can find somebody at Avision who will tell you, you don’t know which custom capability controls that setting. The only way I’ve figured this out in the past is using my tool called ‘Twirl’.
http://www.eztwain.com/twirl.htm
Custom capabilities show up in Twirl as CAP_0x8002, CAP_0x801d, etc.1. Open and enable the TWAIN driver (which brings up the driver’s UI)
2. In Twirl, enable the ‘monitor’ mode (a two-state pushbutton under the Capabilities list)
3. In the scanner UI, change the setting of interest e.g. from Document to Photo
4. Watch to see if Twirl detects a capability changing.If that doesn’t work, then you have to go through the custom capabilities ‘by hand’ so to speak
1. Put the TWAIN driver into the Open state.
2. Note the value of all the custom capabilities that seem like they might control Document vs Photo
(For example, it’s probably going to be a capability with a small number of integer values, not a string or Boolean.)
3. Enable the driver and change Document to Photo or vice versa.
4. Disable the driver or start a scan, forcing the driver to ‘save’ what is shown in it’s UI
5. Back in Twirl go through and click on each possible custom capability which triggers a ‘MSG_GET’ which shows the latest value. Again, you are looking for one that has changed.
6. Assuming you find it, you can use the [Set] and [Reset] buttons to see if you can control the setting (SET it, then Enable the driver, see what the UI shows, Disable the driver, SET a different value, Enable the driver, see if the UI value has changed.)- AuthorPosts