Skip to main content

Get image size (:size)

Declaration

w, h = img:size()

Returns

  • w, h
    Integer. Width and height of the image object

Description

Get width and height of the image object. Note that width may not be less than height; rotation can change dimensions

Example

local img = image.load_file("/var/mobile/1.png")
local w, h = img:size()
sys.alert("Width: "..w.."\nHeight: "..h)