Dev - Lua Libraries

Lua Command: s3sprite.getImageSize

Parameters

Return Values

Signature

int width, int height = s3sprite.getImageSize(int imageID)

Description

Gets the width and height of the image with the the given imageID in pixels. It is either equal to the rectW/rectH used in s3sprite.load or it is equal to the full image size if no custom rect was specified in s3sprite.load.

width and height will both be 0 if the given image does not exist.

Example:

Print the width and height of an image
1
2
3
cursor = s3sprite.load("interface/cursor.png")
w, h = s3sprite.getImageSize(cursor)
print("image with ID " .. cursor .. " has a size of " .. w .. " x " .. h .. "pixels!")

Note:

This command is used to get the size of a loaded image. Use s3sprite.getSize if you want to get the size of a sprite instance.