Results 1 to 13 of 13

Thread: WIA Scanner Image coloring

Threaded View

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Apr 2005
    Posts
    105

    WIA Scanner Image coloring

    Dear All,

    I use following code to scan Visiting Cards, ID Cards, ATM Card etc.

    VB6 Code Code:
    1. Dim WiaCD As New wia.CommonDialog
    2. Set WiaDev = WiaCD.ShowSelectDevice(ScannerDeviceType, False, False)
    3. Dim itm As wia.item
    4. Dim ItmProp As wia.Property
    5. varDPI = 200                    ' DPI
    6. varFac = 25.4 / varDPI          ' Pixelfactor
    7. varArea = Array(0, 0, 3.38, 2.13) ' Scan area (mm)
    8. varMode = 4                     ' 1=color 2=gray 4=b/w
    9. varBri = -10                    ' Brightness
    10. varContr = 0                    ' Contrast
    11. ' loop through each item/property and set parameters
    12. For Each itm In WiaDev.Items
    13.  For Each ItmProp In itm.Properties
    14.   Select Case ItmProp.PropertyID
    15.   Case 4112 ' Pixel per Line (must be equal to 6151 ?)
    16.    'n = Int(varArea(2) / varFac + 0.5)
    17.    'ItmProp.Value = n
    18.   Case 6147 ' Horizontal Resolution
    19.    ItmProp.Value = varDPI
    20.   Case 6148 ' Vertical Resolution
    21.    ItmProp.Value = varDPI
    22.   Case 6149 ' Horizontal Starting Position (in pixel?)
    23.    ItmProp.Value = 0
    24.   Case 6150 ' Vertical Starting Position (in pixel?)
    25.    ItmProp.Value = 0
    26.   Case 6151 ' Horizontal Extent (Scanning Area in pixel)
    27.    n = CInt(varArea(2)  * varDPI)
    28.    ItmProp.Value = n
    29.   Case 6152 ' Vertical Extent (Scanning Area in pixel)
    30.    n = CInt(varArea(3) * varDPI)
    31.    ItmProp.Value = n
    32.   Case 6154 ' Brightness
    33.    ItmProp.Value = varBri
    34.   Case 6155 ' Contrast
    35.    ItmProp.Value = varContr
    36.   Case 6146 ' Current Intent
    37.    ItmProp.Value = varMode
    38.   Case 3096
    39.   ' ItmProp.Value = 0
    40.   End Select
    41.  Next
    42. Next
    43. ' scanning
    44. Dim item As wia.item
    45. Set item = WiaDev.Items(1) 'the needed ITEM object = 1st scanner
    46. Dim img As wia.ImageFile
    47. Set img = item.Transfer 'transfers the image
    48. '...
    49. img.SaveFile (filename)

    But I get images in black and white only. How can I get it in color.

    Pls help me

    Regards,
    Nasreen
    Last edited by nasreen; Feb 12th, 2012 at 12:52 PM. Reason: Attachment removed

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width