Skip to content

Commit

Permalink
match color depth with chosen color mode
Browse files Browse the repository at this point in the history
  • Loading branch information
nagimov committed May 27, 2019
1 parent a68c11a commit 67ff826
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

This (very) small utility (~30 KB executable) provides an easy to use command-line interface to WIA-compatible scanners for Windows OS. If scanner is accessible using `Windows Fax and Scan` application, it is very likely to be compatible with this tool. Compiled binaries can be downloaded from [Releases](https://github.com/nagimov/wia-cmd-scanner/releases)

The utility is built around WIA (Microsoft Windows Image Acquisition Library). Depending from version of Windows OS, WIA library (included file `Interop.WIA.dll`) can be required to be placed next to `wia-cmd-scanner.exe` executable. No other external dependencies are required (targeted .NET framework 3.5 comes pre-installed starting from Windows 7). The utility is portable and requires no installation. Both 32-bit and 64-bit versions of Windows OS are supported.
The utility is built around WIA (Microsoft Windows Image Acquisition Library) and requires [Microsoft .NET Framework 4.0](https://www.microsoft.com/en-us/download/details.aspx?id=17718) (it is likely already included in your Windows OS). The utility is portable and requires no installation. Both 32-bit and 64-bit versions of Windows OS are supported.

## Usage

Expand Down
7 changes: 6 additions & 1 deletion wia-cmd-scanner.vb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Module Module1

Sub printUsage()
Const version = "0.2"
Const version = "0.2.1"
Console.WriteLine("wia-cmd-scanner (version " & version & ") ")
Console.WriteLine("License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html> ")
Console.WriteLine(" ")
Expand Down Expand Up @@ -85,12 +85,16 @@ Module Module1
End If

Dim colorcode As Integer
Dim depth As Integer
If color = "RGB" Then
colorcode = 1
depth = 24
ElseIf color = "GRAY" Then
colorcode = 2
depth = 8
ElseIf color = "BW" Then
colorcode = 4
depth = 1
Else
printUsage()
Exit Sub
Expand Down Expand Up @@ -142,6 +146,7 @@ Module Module1
' set scan parameters
Dim props As New Dictionary(Of String(), Double)()
props.Add({"6146", "WIA_IPS_CUR_INTENT", "color mode"}, colorcode) ' color mode
props.Add({"4104", "WIA_IPA_DEPTH", "color depth"}, depth) ' color depth
props.Add({"6147", "WIA_IPS_XRES", "resolution"}, dpi) ' horizontal dpi
props.Add({"6148", "WIA_IPS_YRES", "resolution"}, dpi) ' vertical dpi
If w > 0 Then
Expand Down

0 comments on commit 67ff826

Please sign in to comment.