Function Reference


_GDIPlus_ImageGetDimension

Gets the width and height of an image which is supported by GDIPlus

#include <GDIPlus.au3>
_GDIPlus_ImageGetDimension ( $hImage )

Parameters

$hImage  A handle to image object

Return Value

Success: An array with two entries:
    Array[0] = width of the image object
    Array[1] = height of the image object.
Failure: Sets the @error flag to non-zero, @extended may contain GPSTATUS error code ($GPIP_ERR* see GPIPlusConstants.au3).

Related

_GDIPlus_ImageGetWidth, _GDIPlus_ImageGetHeight

See Also

Search GdipGetImageDimension in MSDN Library.

Example

#include <GDIPlus.au3>
#include <MsgBoxConstants.au3>

Example()

Func Example()
        Local $aDim, $hImage, $sFile

        $sFile = FileOpenDialog("Please select an image", "", "Image (*.jpg;*.png;*.bmp;*.gif;*.tif)", BitOR($FD_PATHMUSTEXIST, $FD_FILEMUSTEXIST))
        If @error Then Exit MsgBox(($MB_ICONERROR + $MB_SYSTEMMODAL), "Error", "No image file has been selected", 30)

        _GDIPlus_Startup()

        $hImage = _GDIPlus_ImageLoadFromFile($sFile)
        If @error Or Not $hImage Then
                MsgBox(($MB_ICONERROR + $MB_SYSTEMMODAL), "Error", "This file isn't supported by GDIPlus!")
        Else
                $aDim = _GDIPlus_ImageGetDimension($hImage)
                MsgBox($MB_ICONINFORMATION, "Information", "Image dimension of " & @CRLF & $sFile & @CRLF & @CRLF & "Width = " & $aDim[0] & " pixel" & @CRLF & "Height = " & $aDim[1] & " pixel")
                _GDIPlus_ImageDispose($hImage)
        EndIf

        _GDIPlus_Shutdown()
EndFunc   ;==>Example