Dynamic Scaling Wrong on Device?

Hi,

I’m testing dynamic content scaling on an actual Samsung Galaxy Tab 2 device and I’m getting black bars on each side. I’ve set the background color to red so that you can see the bars.

Here’s a screenshot taken on the device: http://www.imagebam.com/image/5fda69235989567

On the simulator the scaling works perfectly.

My images are 360 x 570 base, 720 x 1140 @2x, and 1440 x 2280 @ 4x

This is my config.lua:

 application =  
{  
 content =  
 {  
 width = 320,  
 height = 480,  
 scale = "letterBox",  
  
 imageSuffix =  
 {  
 ["@2x"] = 1.5,  
 ["@4x"] = 3.0,  
  
 },  
  
 },  
}  

The resolution on the Samsung Galaxy Tab 2 is 600 x 1024, so the scaling should work. It does on the simulator, but not on the real device. Can anyone help? Thanks. [import]uid: 153562 topic_id: 35669 reply_id: 335669[/import]

Not sure if this will solve your problem but I think ‘letterbox’ should be all lower-case? [import]uid: 93133 topic_id: 35669 reply_id: 141854[/import]

I tried changing “letterBox” to “letterbox” but it’s still not working. It must be some other issue. [import]uid: 153562 topic_id: 35669 reply_id: 141858[/import]

1024 / 600 = 1.706 aspect ratio.

You’re config.lua is 320 x 480 which is 480 / 320 which is a 1.50 aspect ratio. Your yellow area represents the 1.50:1 aspect ratio area. The red is the wider 1.706:1 area.

If your config.lua was more like. 320 x 546, your screen would fit exactly. We did a blog post on setting up a flexible config.lua file. See:

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

[import]uid: 199310 topic_id: 35669 reply_id: 141921[/import]

Rob, I took a look at the “ultimate config.lua file,” but I’m still wondering:

If my config.lua is 320 x 480, on a 600 x 1024 device, wouldn’t the scale factor be 1.875? Covering an area of 600 x 900, leaving an area of 1024 - 900 = 124 pixels (black bars).

But my base image is 360 x 570, wouldn’t scaling that up by 1.875 make the image 675 x 1068.75, leaving more than enough bleed area to cover any black bars?

Or am I missing something? [import]uid: 153562 topic_id: 35669 reply_id: 141926[/import]

@nic_det
Your calculations seem correct, and it’s strange that it works in the simulator and doesn’t on the device.

I have a small sample project which I wrote last year which I know works on all my devices:
http://www.swipeware.com/backgrounds-with-no-black-borders-on-appleandroid-devices

Could you give it a try to see if you get the same results?
[import]uid: 70847 topic_id: 35669 reply_id: 141949[/import]

@ingemar
Your example does work on the device and I think I’ve figured out why.

According to Samsung the screen resolution of the Galaxy Tab 2 is 600 x 1024, but in the latest update they’ve added a home bar to the screen, which takes up space and changes the aspect ratio.

Using display.pixelWidth and display.pixelHeight, I now know that the actual resolution of the device is 552 x 1024, so Corona will scale at 1.725 instead of 1.875.

So my base image of 360 x 570 will scale to 621 x 983.25, which will in fact leave black bars.

Your base image is 420 x 610 which scales to 724.5 x 1052.25, so no black bars.

The problem is that the aspect ratio on the Galaxy Tab 2 is not 1.7 (600 x 1024), but in fact 1.86 (552 x 1024)

So the base image has to have a width of at least 594 (1024 / 1.725) to not show any black bars after scaling. I’ve tested on the device and it works now with the base image size of 360 x 594.

So anyone targeting the Galaxy Tab 2 should know that the resolution may be 552 x 1024 to avoid future scaling headaches like me :slight_smile:

Thanks to everyone for the help. [import]uid: 153562 topic_id: 35669 reply_id: 141953[/import]

Great to hear that you solved the problem :slight_smile:
…and good to know about the Galaxy Tab 2. [import]uid: 70847 topic_id: 35669 reply_id: 141958[/import]

Not sure if this will solve your problem but I think ‘letterbox’ should be all lower-case? [import]uid: 93133 topic_id: 35669 reply_id: 141854[/import]

I tried changing “letterBox” to “letterbox” but it’s still not working. It must be some other issue. [import]uid: 153562 topic_id: 35669 reply_id: 141858[/import]

1024 / 600 = 1.706 aspect ratio.

You’re config.lua is 320 x 480 which is 480 / 320 which is a 1.50 aspect ratio. Your yellow area represents the 1.50:1 aspect ratio area. The red is the wider 1.706:1 area.

If your config.lua was more like. 320 x 546, your screen would fit exactly. We did a blog post on setting up a flexible config.lua file. See:

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

[import]uid: 199310 topic_id: 35669 reply_id: 141921[/import]

Rob, I took a look at the “ultimate config.lua file,” but I’m still wondering:

If my config.lua is 320 x 480, on a 600 x 1024 device, wouldn’t the scale factor be 1.875? Covering an area of 600 x 900, leaving an area of 1024 - 900 = 124 pixels (black bars).

But my base image is 360 x 570, wouldn’t scaling that up by 1.875 make the image 675 x 1068.75, leaving more than enough bleed area to cover any black bars?

Or am I missing something? [import]uid: 153562 topic_id: 35669 reply_id: 141926[/import]

@nic_det
Your calculations seem correct, and it’s strange that it works in the simulator and doesn’t on the device.

I have a small sample project which I wrote last year which I know works on all my devices:
http://www.swipeware.com/backgrounds-with-no-black-borders-on-appleandroid-devices

Could you give it a try to see if you get the same results?
[import]uid: 70847 topic_id: 35669 reply_id: 141949[/import]

@ingemar
Your example does work on the device and I think I’ve figured out why.

According to Samsung the screen resolution of the Galaxy Tab 2 is 600 x 1024, but in the latest update they’ve added a home bar to the screen, which takes up space and changes the aspect ratio.

Using display.pixelWidth and display.pixelHeight, I now know that the actual resolution of the device is 552 x 1024, so Corona will scale at 1.725 instead of 1.875.

So my base image of 360 x 570 will scale to 621 x 983.25, which will in fact leave black bars.

Your base image is 420 x 610 which scales to 724.5 x 1052.25, so no black bars.

The problem is that the aspect ratio on the Galaxy Tab 2 is not 1.7 (600 x 1024), but in fact 1.86 (552 x 1024)

So the base image has to have a width of at least 594 (1024 / 1.725) to not show any black bars after scaling. I’ve tested on the device and it works now with the base image size of 360 x 594.

So anyone targeting the Galaxy Tab 2 should know that the resolution may be 552 x 1024 to avoid future scaling headaches like me :slight_smile:

Thanks to everyone for the help. [import]uid: 153562 topic_id: 35669 reply_id: 141953[/import]

Great to hear that you solved the problem :slight_smile:
…and good to know about the Galaxy Tab 2. [import]uid: 70847 topic_id: 35669 reply_id: 141958[/import]

thanks a lot!

thanks a lot!