CmdTwain has had the ability to send special commands to your document scanner for some time now. It wasn’t widely advertised but a few people who had unusual problems learnt of the unusual settings solution. Here’s the details …
Firstly, some settings are mentioned in the current help file. These include BR for brightness, CO for contrast and ADF to turn on (or off) your automatic document feeder. To use these you add “/S setting value” to the command line like this:
CmdTwain /S BR 500 /S CO 100 c:\Users\Greg\Documents\scan.jpg
The commands get sent to the document scanner in the same order they appear on the command line so the above sets the brightness to 500, then the contrast to 100 and scans a page to “scan.jpg” in my “Documents” folder. The order is only important if you send a command that affects earlier settings.
Not all scanners support all commands. Not all scanners support all values. Think of the settings feature in CmdTwain as a way to access what’s available to you. BRightness and COntrast are probably available to everyone; but turning on a document feeder that you don’t have isn’t going to do much for you. Some document scanners only work in steps so “/S BR 100”, “/S BR 200” may work when “/S BR 101” might not. Some scanners might give you the closest available value. Others might just ignore you. The easiest way to determine whether it worked or not is to just look at the result. CmdTwain won’t pop up an error message.
Special Commands for Special Problems
The “/S setting value” option actually allows you to send most of the commands defined in the TWAIN specification to your document scanner. It also allows you to send unspecified ones too, if your manufacturer has added some custom ones.
Every scanner command has a command number, a type, and a value – even if the value is just on (1) or off (0). You can find commands in your scanner manual, on the internet or in the TWAIN specification. Each command has a specific type and that is spelled out for each command. The specification will also tell you what range of values is supposed to be acceptable for each command. Your document scanner manual may too.
CmdTwain will allow you to send a single command, type value combination. Commands that require more than one value aren’t supported. Commands that send strings of text to the scanner (if there are any) aren’t supported. Pretty much everything else is. The format is:
/S cmd,type value
Some examples are:
Set gamma to 0.5 “/S 4360,7 0.5”
Turn on the autobrightness option “/S 4352,6 1”
The setting numbers and types are hard to remember so CmdTwain keeps a list of some of them handy. You can see the CmdTwain scanner setting names that it knows by typing “%AppData%\GssEziSoft\CmdTwain” into a Windows Explorer address bar (where it normally shows “C:\Users\name\Documents\…” or “This PC > Documents”). That’ll show you a folder containing a scanner.txt file. If you open that you’ll see a list like:
# Scanner.txt - TWAIN Settings # Brightness & Contrast. Range -1000..1000, 0 is normal BR = 4353,7 CO = 4355,7 # Doc Feeder, Duplex, Autofeed, Autoscan. Use 1 for on, 0 for off ADF = 4098,6 DPX = 4115,6 AF = 4103,6 AS = 4112,6 # GAMMA = 4360,7
The gamma one is new for CmdTwain 2.03 (not publically available at the time of this post). It is likely to also include:
AUTOBR = 4352,6 BPP = 4395,4
to set autobright on or off and the number of bits per pixel for those that require access to 256 shades of gray instead of the scanner default.
If you have some additional favourites, you can add them in to the scanner.txt file BUT save a copy because they’ll get replaced if you later update CmdTwain.