Skip to Main Content

How ImageGear’s TWAIN Scanning Enhances Application Workflows

Printers, scanners, and other imaging devices have long been a source of headaches and frustration for developers and users alike. All too often, multiple software tools are required to connect an application to a device and acquire image files from them. This not only slows down workflows, but also creates opportunities for human error. Files can easily be misplaced or imported using the wrong parameters under these conditions.

Thanks to ImageGear’s TWAIN scanning support, however, developers can ensure that their application makes acquiring images from compatible devices both straightforward and mistake free. 

What Is TWAIN?

Developed in 1992 by a consortium of software developers and hardware manufacturers, the TWAIN standard is a standard software protocol and API that facilitates communication between imaging devices and software applications running on a computer. The word itself refers to a famous line in the Rudyard Kipling poem “The Ballad of East and West” that reads “never the twain shall meet.” Although sometimes alleged to stand for “Technology Without An Interesting Name,” the term is not actually an acronym despite being capitalized.

The name is well chosen because the TWAIN standard helped to solve the enduring problem of getting imaging devices and computers to connect and send data between one another. Most commonly used for scanners and digital cameras, TWAIN made it possible to request an image file to be imported into an application without having to utilize additional software or input commands using the physical device.

Implementing TWAIN Scanning with ImageGear

As a versatile image processing SDK, ImageGear fully supports the TWAIN specification, which allows developers to support any TWAIN-capable device directly into their applications. In most instances, this will involve adding a “Scan” button or option somewhere in the platform’s interface so that users can quickly and easily instruct their scanner to capture an image and pass it along to the application’s storage or workflow. Developers can also use the integration to adjust device settings directly from their application, such as changing the scanning area, modifying brightness and contrast, or increasing/decreasing dots-per-inch (resolution). 

ImageGear’s TWAIN scanning feature works with three external elements to facilitate image file transfers:

  • The Device: Usually a scanner or digital camera, this is the primary imaging source. The device must be compliant with TWAIN protocol.This is typically indicated by the manufacturer.
  • Data Source: Although ImageGear’s TWAIN scanning features can connect an application to a scanner, the device still needs a software driver that allows it to communicate with the computer’s operating system.
  • Data Source Manager: The TWAIN manager software provides a universal mechanism for managing and using data sources from different device manufacturers. Developed by the TWAIN consortium, it can be downloaded for free and installed wherever the application is running.

(Both the device’s data source driver and TWAIN data source manager should be included with its installation software. They are not provided by the ImageGear SDK).

Acquiring an Image Using TWAIN Scanning

ImageGear can configure an application to gather an image or set of images from a connected device with a few simple steps.

Step 1: Open the Data Source

Developers can set the application to automatically open a default Data Source. This is typically the best choice when only one scanner is available, as is often the case in a small workplace. They can also use the Data Source Manager to provide a list of all available Data Sources and let the user select the one they need.

Step 2: Adjust Settings

ImageGear’s TWAIN scanning features allow image acquisition parameters to be set through the application. Parameters such as page count and image size can be set to a common default, but developers can also give the option to obtain the various capabilities (listed as “ScanCaps”) and display them for users to select from. ImageGear supports a wide range of TWAIN-related capabilities.

Step 3: Acquire Image

After all settings are configured, the image can be scanned and loaded into an ImGearPage Class object. When acquiring a multi-page image, ImGearPages are loaded into an ImGearDocument Class object instead.

How ImageGear TWAIN Scanning Looks in Code

As an example, here’s what the C# code may look like when using ImageGear to help an application import an image from a TWAIN Data Source:

using System;
using ImageGear.Core;
using ImageGear.TWAIN;

public ImGearPage AcquireImage(IntPtr Handle)
    ImGearPage igPage = null;
    ImGearTWAIN igTWAIN = new ImGearTWAIN();

    igTWAIN.WindowHandle = Handle;
    igTWAIN.UseUI = true;

        // Open the data source selection dialog

        // Initialize the scanning
        igPage = igTWAIN.AcquireToPage();

    catch(ImGearException e)
        // Handle the exception ...

        if(igTWAIN.DataSourceManagerOpen == true)

    return igPage;

Expand Your Application’s TWAIN Support with ImageGear

Accusoft’s ImageGear SDK provides comprehensive support for a broad range of TWAIN devices, which makes it easier than ever for developers to control the scanning process directly from their applications. Integrating TWAIN scanning can streamline workflows and significantly improve the software user experience by completely eliminating the need to turn to external programs for image acquisition. ImageGear is fully compatible with multiple generations of the TWAIN standard, including TWAIN v1.6, v1.7, v1.8, v1.9, and v2.4.

In addition to TWAIN scanning support, ImageGear provides powerful image and document processing capabilities that can transform your application workflows. With extensive file conversion and compression features, it’s the best way to quickly integrate content management features into your platform. To get a glimpse of what ImageGear can do for your .NET application, download a free trial today and start building.