The theme I'm using has this code
local bgart = fe.add_artwork( "flyer", flw*0.2, 0, flw*0.6, 0);
bgart.preserve_aspect_ratio = true;
That is, it scales the image width to 60% of screen width and scales the height accordingly to keep the original aspect ratio.
But when I have an artwork in landscape direction, the scaled height is too short to fill the screen (see attached pic).
So I want to check the actual dimension of the image and scale it differently, either by width or by height.
I tried this code
local bgart = fe.add_artwork( "flyer", flw*0.2, 0, flw*0.6, 0);
bgart.preserve_aspect_ratio = true;
if ( bgart.height < flh )
{
bgart.height = flh;
bgart.width = 0;
}
But it didn't work: "bgart.height" actually returns 0 instead of the actual scaled height, so the test is always true and it always scales to the height.
So is there a way to check the dimension of an artwork?