About Microsoft Windows Image Acquisition Automation Layer
The Windows Image Acquisition (WIA) Automation Layer is a high-quality, full-featured image manipulation component that provides end-to-end image processing capabilities for Microsoft Visual Basic 6.0, Active Server Pages (ASP), and scripting languages. The WIA Automation Layer exposes features in Windows XP Service Pack 1 (SP1) or later to make it easy to acquire images on digital cameras, scanners, or Web cameras, and to rotate, scale, and annotate your image files. Earlier versions of Windows are not supported.
Other new features include the ability to:
- Access the properties of image files.
- Read and write image files and their properties to databases.
- Modify pixels including alpha values.
- Write ASP pages that generate thumbnail images on the fly.
- Take pictures with your Web camera.
- Automatically download pictures from cameras as soon as they are connected, even if a script is not already running.
This overview includes the following topics.
The WIA Automation Layer is broken down into two types of objects. The first type of object is a creatable object. This is an object that can be directly created by calling the Microsoft Visual Basic function CreateObject. In addition, three creatable objects (DeviceManager, CommonDialog, and VideoPreview) are also controls that can be dropped on a form in Visual Basic. The second type of object is the supporting object. This object is not directly creatable but instead is returned from properties or methods. For example, the Connect method on a DeviceInfo object returns a Device object.
The following object hierarchy diagrams show the relationship between objects, collections, and reused objects for both creatable and supporting objects. The hierarchy diagrams use these symbols.
As you can see in the previous illustrations, the WIA Automation Layer reuses objects wherever possible to reduce the number of different objects you need to learn to use. For example, the Device, DeviceInfo, Filter, FilterInfo, Item, and ImageFile objects all reuse the Properties collection to expose their properties. Once you learn how to use the Properties collection on one object you will be able to use it on all the others.
Accessing Imaging Devices
The DeviceManager object and, to a limited degree, the VideoPreview object are the primary ways to access Imaging Devices. The Device object represents an active connection to an Imaging Device. From the Device object you can access its properties, access the items that might be stored on it, transfer those items to files on the computer, and run commands that cause the Imaging Device to do something. For example, you could access a digital camera's date and time, transfer all its pictures to your computer or cause it to take a picture. These actions can be done in one of two ways, programmatically without any user intervention, or using the CommonDialog object to present dialog boxes that enable the user to precisely control the actions.
Manipulating Image Files
Once you have transferred pictures to your computer, you can use the ImageFile object to access the pictures. You can display them on forms, return them as binary data in ASP pages, or access their properties. Many digital cameras store a number of detailed properties in their pictures, from useful information like the date the picture was taken and a thumbnail image to interesting technical details like the model of camera, the focal length, aperture setting, and shutter speed. For more information about detailed properties, see Display all ImageFile Properties and Display Detailed Image Information.
In order to protect the original pictures that represent digital memories, the ImageFile object cannot directly modify the pictures. You can, however, use an ImageProcess object and one or more Filter objects to create a modified copy of the picture. The WIA Automation Layer provides filters that rotate, flip, crop, scale, stamp, modify properties, modify the individual pixels or change the file format to Tagged Image File Format (TIFF), JPEG, Portable Network Graphics (PNG), bitmap (BMP), or Graphics Interchange Format (GIF). For more information about filters, see How To Use Filters.
All reference pages in this documentation set include example code or a link to examples in the Overviews/Tutorials section that illustrate how to use the API. Begin by reading Getting Started with Samples. This topic has the template code for a variety of development environments into which you can paste the reference examples. Shared Samples includes a number of examples that are applicable to a variety of applications.
The following examples are complete samples that you do not need to paste into template code.
- Download New Items as They are Created
- Use VideoPreview Control in HTML
- Implement a Web Camera ASP Page
- Implement a Windows Script Host Script that Runs Automatically