Go Back  Xtreme Visual Basic Talk > Legacy Visual Basic (VB 4/5/6) > Interface and Graphics > WIA:Image access

Thread Tools Display Modes
Old 08-13-2008, 10:16 AM
vitaloverdose vitaloverdose is offline
Join Date: Nov 2007
Posts: 140
Default WIA:Image access

I've been using the WIA to load and manipulate images. This is easy enough when loading images from a disk.
Dim Thumb 'As ImageFile
Dim Img 'As ImageFile
Dim IP 'As ImageProcess

Set Img = CreateObject("WIA.ImageFile")
Set Thumb = CreateObject("WIA.ImageFile")
Set IP = CreateObject("WIA.ImageProcess")

Img.LoadFile "C:\WINDOWS\Web\Wallpaper\Bliss.bmp"
Thumb.LoadFile "C:\WINDOWS\Web\Wallpaper\BlissThumb.bmp"

IP.Filters.Add IP.FilterInfos("Stamp").FilterID
Set IP.Filters(1).Properties("ImageFile") = Thumb
IP.Filters(1).Properties("Left") = Img.Width - Thumb.Width
IP.Filters(1).Properties("Top") = Img.Height - Thumb.Height

Set Img = IP.Apply(Img)

Img.SaveFile "C:\WINDOWS\Web\Wallpaper\BlissStamp.bmp"
But in my program (button editor) I want to load the buttons on top of a chequered background to display them. I've been using a spare form to store all the background images for my program (not sure if this is the right way to do this). I'm not sure how to use any of these background images with the WIA function:
Img.LoadFile "C:\WINDOWS\Web\Wallpaper\Bliss.bmp"
as I haven't got a file name to work with?
Attached Images
File Type: jpg wiaExample.jpg (20.7 KB, 4 views)
Reply With Quote
Old 08-13-2008, 05:31 PM
dilettante's Avatar
dilettante dilettante is offline
Underclocked lifestyle

Forum Leader
* Guru *
Join Date: Feb 2005
Location: Michigan, USA
Posts: 4,400

You can load a WIA.Vector using its BinaryData property. Then convert this to a WIA.ImageFile using the Vector's ImageFile property.

If you load something like a GIF, JPEG, or PNG the format contains dimensions, but if a raw bitmap you'll need to provide optional parameters height and width to the ImageFile property (which acts more like a method really).

These images can be stored in your program as a custom resource, which you create from the original image file on disk.

All of this is in the Windows SDK documentation.
    Set vecImage = New WIA.Vector
    vecImage.BinaryData = LoadResData(ResIndex, "ALPHAIMAGES")
    Set imgfImage = vecImage.ImageFile()
Reply With Quote

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump


Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..