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(“C:\\Images\\Test.tif”, 0,

&dibinfo);

 

 

if (iRet != LS_OK)

{

            // Error

}

 

[VB]

 

‘ Retrieving the width and height of an image file

 

Dim iRes As Long

Dim BiDIBobj as Object

 

Set BiDIBobj = CreateObject("BIDIB.BIDIBCtrl.1")

 

iRes = BiDIBobj.GetDIBWidth(hDib);

 

Set BiDIBobj = Nothing

 

If iRes = -1 Then

            ‘ Error

End If

 

[C#]

 

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

 

int iRes;

 

iRes = BiDIB.GetDIBWidth(hDib);

 

if (iRes == -1)

{

            // Error

}