corona sdk scale images

How to scale images to full screen on all devices, i want to use %

The method I've seen so far is to define pixels

image_variable_name = display.newImage( "testimage.jpg", 100, 300 )

I want to do something like

image_variable_name = display.newImage( "testimage.jpg", 100%, 100% )

But that won't work, I want something like fluid CSS, the image will maintain the size no matter what is the size of the screen. Is it possible?

Try using newImageRect() instead of newImage()

image_variable_name = display.newImageRect("testimage.jpg", display.contentWidth, display.contentHeight)
--then you have to center it:
image_variable_name.x = display.contentWidth / 2
image_variable_name.y = display.contentHeight / 2


Actually Corona uses feature called dynamic scaling so it let you working within same virtual size - 320х480. You can even have different assets for different scale factors.

Use display.newImageRect(), except unlike display.newImage(), you now have to enter the width and height of the image you are feeding in (the actual file). This will now scale automatically.

Also, if you ever switch to landscape mode for your default orientation, make sure your config.lua still has the fields width and height as if you were in portrait mode. Its a weird gotcha.

Here's how I present a background picture which takes up the full screen of a landscape mode 1280 x 720 display (Galaxy S3):

menuBg = display.newImageRect( "images/bg.png", 1280, 720 )