Get an Image’s Resolution

 

The GetImageInfoStructure function (BiDIB.dll) retrieves information about the resolution, size, bitcount and image format of the device independent bitmap. The GetDIBHorizontalDPI and GetDIBVerticalDPI methods are used for retrieving resolution in the BiDIB ActiveX control.

 

[C++]

 

/* Retrieving the resolution 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 resolution of an image file

 

Dim iRes As Long

Dim BiDIBobj as Object

 

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

 

iRes = BiDIBobj.GetDIBVerticalDPI(hDib);

 

Set BiDIBobj = Nothing

 

If iRes = -1 Then

            ‘ Error

End If

 

[C#]

 

/* Retrieving the resolution of an image file*/

 

int iRes;

 

iRes = BiDIB.GetDIBVerticalDPI(hDib);

 

if (iRes == -1)

{

            // Error

}