Hi! This is quite easy, probably!
I am looking for a way to resize images that changes the actual dimensions. Currently, I am using the code below, but when I ask for, for instance, the height of a scaled image, I only get the original height.
Can you suggest another way?
Cheers!
function newScaledImage(filename, settings, baseDirectory, left, top) local img = display.newImage(filename, baseDirectory or "", left, top) -- No settings if (settings.width == nil) and (settings.height == nil) then return img end -- Only one dimension specified if settings.width ~= nil then local ar = settings.width / img.width img.xScale = ar img.yScale = ar --print("ar = " .. ar .. " imgw = " .. img.width) else local ar = settings.height / img.height img.xScale = ar img.yScale = ar --print("ar = " .. ar .. " imgh = " .. img.height) end -- Width and height if (settings.width ~= nil) and (settings.height ~= nil) then local arx = settings.width / img.width local ary = settings.height / img.height img.xScale = arx img.yScale = ary end return img end