Get Image Width, Height

 

The GetImageInfoStructure function/method in the BiDIB DLL/OCX retrieves information about resolution, size, bitcount and image format of the device independent bitmap. The GetDIBWidth and GetDIBHeight methods are used for retrieving image size in the BiDIB ActiveX control.

 

[C++]

 

/* Retrieving the width and height of an image file*/

 

#include “BiDIB.h”

 

DIBINFO dibinfo;

int iRet;

 

/* 1. parameter: path and name of the image file

   2. parameter: page number (zero based integer)

   3. parameter: Pointer to the info structure */

 

iRet = GetImageInfoStructure(_T(“C:\\Images\\Test.tif”), 0,

&dibinfo);

 

 

if (iRet != LS_OK)

{

            // Error

}

 

[C#]

 

/* Retrieving the width and height of an image file*/

 

int iRes;

 

iRes = BiDIB.GetDIBWidth(hDib);

 

if (iRes == -1)

{

            // Error

}

 

Accessing Pixels of the Image

 

Use GetDIBPixelColor of the BiDIB DLL/OCX for retrieving the color of the specific pixel.

 

[C++]

 

/* Retrieving the color of a specific pixel from an image file*/

 

#include “BiDIB.h”

 

BOOL bRet;

COLORREF color;

 

/* 1. parameter: Handle of the DIB

   2. parameter: X coordinate of the pixel

   3. parameter: Y coordinate of the pixel

   4. parameter: Color value

 

bRet = GetDIBPixelColor(hDib, 20, 50, &color);

 

if (!bRet)

{

            // Error

}

 

[C#]

 

/* Retrieving the color of a specific pixel from an image file*/

 

bool bRes;

int lColor;

 

lColor = 0;

bRes = BiDIB.GetDIBPixelColor(hDib, 20, 50, ref lColor);

 

if (!bRes)

{

            // Error

}

 

Checking the Black Ice Imaging Toolkit Version

 

There are several functions/methods to retrieve the version number of the DLL or ActiveX. For example: GetImageVersion (BiDIB), GetTiffVersion (BiTiff).

 

[C++]

 

/* Checking the Black Ice Imaging Toolkit version number*/

 

#include “BiDIB.h”

 

char szVersion[255];

 

/* 1. parameter: Handle of the DIB

   2. parameter: X coordinate of the pixel

   3. parameter: Y coordinate of the pixel

   4. parameter: Color value

 

GetImageVersion(szVersion, 255);

 

[C#]

 

/* Checking the Black Ice Imaging Toolkit version number*/

 

string szVersion;

 

szVersion = BiDIB.GetimageVersion();

 


Scanning Using Black Ice Imaging Toolkits

Scanning with the Black Ice Imaging Toolkits is based on the TWAIN 1.9 drivers.  Using the functionality provided in the toolkit, developers can query and set any capability supported by their TWAIN compatible data source, can programmatically enumerate and set the TWAIN data source and much more.

 

Selecting the TWAIN source

Setting the TWAIN Image Acquisition Mode

Setting the Filename and Format Type for Disk File Transfer

Selecting the paper source

Verifying the TWAIN Version

Controlling the Scanning Capabilities and Other Options

Scanning and Acquiring Pages

Using the User Interface (UI)

Scanning to Disk

Scanning to memory

Processing TWAIN messages

Batch Scanning