Dev - Lua Libraries
Lua Command: s3sprite.getUnloadedImageSize
Parameters
- string imagePath
Return Values
Signature
Description
Gets the width and height of the image with the the given imagePath in pixels. The image does not have to be loaded to make this work.
imagePath must be relative to the folder of the current mod and point to a JPG/JPEG, PNG, BMP or GIF file.
width and height will both be 0 if the given image does not exist or if it was not possible to detect the size.
imagePath must be relative to the folder of the current mod and point to a JPG/JPEG, PNG, BMP or GIF file.
width and height will both be 0 if the given image does not exist or if it was not possible to detect the size.
Example:
Print the width and height of an image without loading it1
2
2
w, h = s3sprite.getUnloadedImageSize("interface/cursor.png")
print("The image has a size of " .. w .. " x " .. h .. "pixels!")
print("The image has a size of " .. w .. " x " .. h .. "pixels!")