Using WIA to scan in VB6
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3

Thread: Using WIA to scan in VB6

Hybrid View

  1. #1
    Join Date
    Mar 2009
    Posts
    1

    Using WIA to scan in VB6

    Files created using the ShowAcquireImage method are huge [approx 26MB]. The same documents scanned using the ShowAcquisitionWizard method are a sensible size [approx 180KB], but there's no programmatic control over the user interface, specifically the path and name of the saved jpg file.

    Can I control the ShowAcquireImage method to use parameters comparable to ShowAcquisitionWizard, or alternatively use the latter but with programmatic control over the user interface?

    My code is

    Set Picture1.Picture = CommonDialog1.ShowAcquireImage.FileData.Picture
    SavePicture Picture1, "C:\ClientData\Sherriff\Scans\VBSAIPic.jpg"

    Thanks for any assistance.

  2. #2
    Join Date
    Feb 2009
    Posts
    239

    Re: Using WIA to scan in VB6

    well if i understand the thing you want to do its to save the pictures directly as jpg right?

    well if ShowAcquireImage doesnt have built in JPG encoding then you will have to do it by yourself.

    and vb6 has not a JPG encode methood built in.


    But check this its a compresor that the autor clayms its pair with comercial JPG compresors, and its just 2 class modules and the best of all its free.

    i didnt had the chances to test it fully but you might try it.

    Check out the zip attached. if you feel its slow i can recomend you a pair of dll+ocx made on c++ to compress jpg.
    Attached Files Attached Files
    Last edited by Alphadan; March 18th, 2009 at 12:27 PM.

  3. #3
    Join Date
    Dec 2008
    Posts
    19

    Re: Using WIA to scan in VB6

    Don't use the Picture save method since VB6 cannot save as JPEG.

    WIA has built in support for saving as jpeg. Convert to jpeg with code like this:

    Dim Img 'As ImageFile

    Set Img = CommonDialog1.ShowAcquireImage

    If Img.FormatID <> wiaFormatJPEG Then
    Dim IP 'As New ImageProcess
    Set IP = CreateObject( "Wia.ImageProcess" )

    IP.Filters.Add IP.FilterInfos("Convert").FilterID
    IP.Filters(1).Properties("FormatID").Value = wiaFormatJPEG
    Set Img = IP.Apply(Img)
    End If

Tags for this Thread

Posting Permissions

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


Azure Activities Information Page

Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center