ImgGetWidth

Syntax

Width = ImgGetWidth(Img)

Description

Retrieves the width, in pixels, of the specified ProGUI image object.

Parameters

Img
The handle of the ProGUI image object whose width is to be retrieved.

Return Value

Returns the width of the image in pixels (Integer). Returns 0 or #False if the image handle is invalid.

Remarks

This function returns the native pixel width of the base image associated with the handle, regardless of any scaling applied during drawing or the existence of alternative size variants (ImgAddSize()).

Example

IncludeFile "ProGUI_PB.pbi"

StartProGUI()

MyImage = CreateImg(120, 80, RGB(255, 255, 0)) ; Create a 120x80 yellow image

If MyImage
  Width = ImgGetWidth(MyImage)
  Debug "Image Width: " + Str(Width) + " pixels" ; Output: Image Width: 120 pixels

  FreeImg(MyImage)
EndIf

StopProGUI()

See Also

ImgGetHeight, CreateImg, LoadImg

Supported OS

Windows, Linux