Previous Topic

Next Topic

Book Contents

Book Index

GetImageDimension

Description:

The GetImageDimension will analyze the specified file and extract the dimensions from the file. The information you get are;

Declaration:

Declare Function GetImageDimension Lib "VCII2LN.DLL" (_
Byval pstrFilename As String, _
iX As Integer, _
iY As Integer, _
iBitDepth As Integer, _
iDpiX As Integer, _
iDpiY As Integer) As Long

Parameters:

Param

Description

pstrFilename

The full filename of the image to extract dimensions from.

Starting from version 1.4 of II2LN you can also specify any http:// or file:// URL in this parameter

iX

The output parameter containing the Width (X) in pixels

iY

The output parameter containing the Height (Y) pixels

iBitDepth

The output parameter containing the bitdepth

iDpiX

The DPI of the image in X direction

iDPI

The DPI of the image in Y direction


Returns:

-1 if the image format was not recognized. Otherwise 1.

Please note that the DPI variables may contain 0 if no DPI information was found in the image.


Usage:

Dim lRc As Long
Dim iX As Integer
Dim iY As Integer
Dim iBitDepth As Integer
Dim iDpiX As Integer
Dim iDpiY As Integer

lRc = GetImageDimension(strFileName, iX, iY, iBitDepth, iDpiX, iDpiY)

If lRc = 1 Then
Messagebox "The image dimensions are X=" & Cstr(iX) & " Y=" & Cstr(iY) & _
" BitDepth=" & Cstr(iBitDepth) & " DpiX=" & Cstr(iDpiX) & _
" DpiY=" & Cstr(iDpiY), 0, "Image Dimensions"
Else
Messagebox "Not a valid image file", 0, "Image Dimensions"
End If

Introduced in version:

1.5.0.0

See Also

Functions

Identification functions

ImportImage

ImportImageAsResource

AttachImage

ProcessImage

GetImageFromClipboard

GetTIFFFrameCount

GuessImageFormat

GuessImageFormatStrict