Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Scanning with WIA 1

Status
Not open for further replies.

dpaulson

Programmer
May 7, 2000
347
0
0
CA
I can scan and put the acquired image into a picture box with
Code:
    Set wiaCDL = New WIA.CommonDialog    
    Set Picture1.picture = wiaCDL.ShowAcquireImage.FileData.picture
but the picture is huge. Only the top left corner can be viewed. Also when I print the image to a print, only the top left corner can be printed.

Code:
    Printer.PaintPicture Picture1.picture, 1, 1



David Paulson

 
What can be done to get the picture close to the original size?

David Paulson

 
Try this:

p = wiaCDL.ShowAcquireImage.FileData.picture
Picture1.Picture = LoadPicture("") ' maybe you dont need this
Picture1.PaintPicture p, 0, 0, sizew, sizeh

if the forst line does not work you may use
Set p = LoadPicture("yourfilename.bmp")

sizew and sizeh are your width and heights. eg: 1000 and 1500

 
probably you must use the set statement in p=

set p = wiaCDL.ShowAcquireImage.FileData.picture
 
And to print I use this:

Printer.PaintPicture p, 0, 0, sizew, sizeh
 
Thankyou for that. I have some tweaking to do, but I am going in the right direction.



David Paulson

 
You can use a WIA Filter to scale the image as well.

Here imgPhoto is an ImageFile object:
Code:
    Set ipPhoto = New WIA.ImageProcess
    With ipPhoto
        .Filters.Add .FilterInfos!Scale.FilterID
        With .Filters(1).Properties
            !MaximumWidth = lngPixelsX
            !MaximumHeight = lngPixelsY
        End With
        Set imgPhoto = .Apply(imgPhoto)
    End With
You can also crop, etc. using other filters.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top