background image.

Hello my fellow corona users, pls i am new here, just trying out few minor projects. I saw online when someone loaded a background image that fits the screen with out using the ( isFullResoultion ) parameter…How can i do the same…am only new here and thanks for the help.

Do you wish to stretch/scale the image to the full screen size, or do you want to load higher (or lower) resolution images depending on the device, i.e. iPad vs. iPad Retina?

Brent

i want to scale the image to the full screen size and also i would be glad if u can guide me through loading higher/lower resolution images. Thanks for the reply.

Hi @gabbi.xans,

To scale an image to the full screen, you can try this:

[lua]

myImage.width, myImage.height = display.pixelWidth, display.pixelHeight

myImage.x, myImage.y = display.contentCenterX, display.contentCenterY

[/lua]

Depending on the image size, however, that might stretch it unevenly. If you want to scale it evenly with the shortest side of the image fitting to the shortest side of the screen (with the rest bleeding off-screen), then you’ll need to scale it a bit differently.

In terms of dynamically loading higher-res or lower-res images per device, please refer to this guide:

http://docs.coronalabs.com/guide/basics/configSettings/index.html

And another useful tutorial is here:

http://www.coronalabs.com/blog/2012/12/04/the-ultimate-config-lua-file/

Regards,

Brent

Mr Brent tnx lots for ur help. The other two links u sent me about the config.lua kinda confused me a little bit. Please can you send me like a sample of code which scales an image evenly with the shortest and longest sides of the image fitting the shortest and longest sides of the screen. Thanks once more for your help, wl be expecting ur reply.

Hi @gabbi.xans,

It’s quite important to understand the “config.lua” eventually. Since you’re new to Corona, perhaps you should start with these tutorials:

http://docs.coronalabs.com/guide/start/helloWorld/index.html

http://docs.coronalabs.com/guide/media/displayObjects/index.html

http://docs.coronalabs.com/guide/start/displayGroups/index.html

And then seek other tutorials here:

http://www.tandgapps.co.uk/resources/coronalabs-resources/

Hope this helps,

Brent

Do you wish to stretch/scale the image to the full screen size, or do you want to load higher (or lower) resolution images depending on the device, i.e. iPad vs. iPad Retina?

Brent

i want to scale the image to the full screen size and also i would be glad if u can guide me through loading higher/lower resolution images. Thanks for the reply.

Hi @gabbi.xans,

To scale an image to the full screen, you can try this:

[lua]

myImage.width, myImage.height = display.pixelWidth, display.pixelHeight

myImage.x, myImage.y = display.contentCenterX, display.contentCenterY

[/lua]

Depending on the image size, however, that might stretch it unevenly. If you want to scale it evenly with the shortest side of the image fitting to the shortest side of the screen (with the rest bleeding off-screen), then you’ll need to scale it a bit differently.

In terms of dynamically loading higher-res or lower-res images per device, please refer to this guide:

http://docs.coronalabs.com/guide/basics/configSettings/index.html

And another useful tutorial is here:

http://www.coronalabs.com/blog/2012/12/04/the-ultimate-config-lua-file/

Regards,

Brent

Mr Brent tnx lots for ur help. The other two links u sent me about the config.lua kinda confused me a little bit. Please can you send me like a sample of code which scales an image evenly with the shortest and longest sides of the image fitting the shortest and longest sides of the screen. Thanks once more for your help, wl be expecting ur reply.

Hi @gabbi.xans,

It’s quite important to understand the “config.lua” eventually. Since you’re new to Corona, perhaps you should start with these tutorials:

http://docs.coronalabs.com/guide/start/helloWorld/index.html

http://docs.coronalabs.com/guide/media/displayObjects/index.html

http://docs.coronalabs.com/guide/start/displayGroups/index.html

And then seek other tutorials here:

http://www.tandgapps.co.uk/resources/coronalabs-resources/

Hope this helps,

Brent