@Voland, we would need to see your config.lua file and a chunk of your code where you’re loading the image.
I could very easily explain why my trick works (not really my trick, google “corona magic recipe”) if I had you in a room with me and had a marker board. It would take hours upon hours to put together screen shots and draw everything out.
@thedog’s example is really good if you just want a solid full screen rectangle, but what if you want an image in the background that will cover all your bases? Then you have to use a “bleed” technique to make this happen. I’ll try to explain this with words.
First lets assume that your config.lua is just 320x480 and letterBox, a very common format. On an iPhone and iPod - pre iPhone5/tall iPod, this fits perfectly and nothing else is needed. Lets go to the iPhone 5 or any 16:9 Android device. When using a 320x480 scale, the iPhone 5’s screen becomes 320x568. We have 88 more pixels in width to work with. Draw your background at 320x480 and you end up with black letterbox bars on either side that are 44 px wide. To cover that area, you need an image that is 568 px wide. Those 44px on each side are outside the defined width and height. In other words if you draw something at 0,0 it will be 44 px right of the left edge of the screen (assuming landscape here). If you draw something at display.contentWidth, it will be 44 px short of the right side. This is why Corona Labs recommends adding a conditional check in your config.lua to make it 320x568 for those devices.
Okay, introduce an iPad. At this scale and with letterboxing, Corona is going to make sure the 480px wide fits into the screen which will make black bars appear at the top and bottom. Because at 480px wide, the screen’s vertical space is 360px high (480 / 1.33333 … the aspect ratio of the screen) = 360px. Now since you’re only using 320px in your config.lua, you will have letterbox bars at the top and bottom of 40 total pixels (360-320) or 20 at the top and 20 at the bottom.
If you load an image that is 568x360 (or 1136x720 etc.) like:
bg = display.newImageRect("bgimage.jpg",568,360)
On the iPad, it will fill vertically (remember this is a Landscape example) but 88 pix on the sides are going to “bleed” off screen. That is 44px on the left and 44px on the right will be off screen. Switch to an iPhone 5 and you get the full width but some of the top and bottom are going to be off screen. In regular iPhone mode, you’re going to loose some off screen both directions.
This is okay as long as you don’t put anything critical in the background in these bleed areas.
Why 570 and not 568? First 570 is easier to remember, but it has to do with Android devices. 16:9 is like 1.777777778 to one. If you multiple 320 by that, you get 568.88889 or realistically 569. Many android devices are a touch bigger some are smaller but 570 seems to be the safe size to get everything. [import]uid: 19626 topic_id: 32752 reply_id: 130301[/import]