Displaying a background in corona

Hi Folks,

I have a very basic newbie problem. My background image comes in scaled on a iPad

I want to display a background image. I am using this code

width = 1024
height = 768

local background = display.newImageRect( "images/bedroom/bedroom.png", 1024,768 )  

Any ideas why it would be scaled

Thanks [import]uid: 120979 topic_id: 20973 reply_id: 320973[/import]

Hi

try using display.newImage() instead…
or read the API description of display.newImageRect() closer.

display.newImageRect() uses dynamic scaling this means you should have two
png’s in your assets folder for each png you want to use:

one called: “bedroom.png” with the size 512, 384
and one called: “bedroom@2x.png” with the size 1024, 768

if you are on a low resolution device ( iPhone3 etc.) then display.newImageRect() will use “bedroom.png” if you are on a high resolution device (iPhone4, iPad) it will use"bedroom@2x.png"

You also need to put some code in your config file. Read more about it here:
http://blog.anscamobile.com/2011/01/dynamic-image-resolution-made-easy/
[import]uid: 13632 topic_id: 20973 reply_id: 82818[/import]

Thanks, the problem was the config file. The original dimensions of the image are
w = 1024 and h = 768

But in the config i had to switch to width = 768 and height = 1024 and scale to letterbox [import]uid: 120979 topic_id: 20973 reply_id: 82820[/import]