Images are not being resized automatically on Galaxy SII

My application has a config.lua like this:

application = {     content = {         width = 320,         height = 480,         scale = "letterBox",         fps = 30,     },  }  

I installed the application on my Galaxy SII. I think I had read somewhere that Corona has the ability to resize automatically the images on the device screen. With that in mind, I was expecting my images (specially the background image which has dimensions 320x480) to be resized, but it didn’t happen.

What’s wrong?

Thanks.

 

Are you using display.newRect() or display.newImageRect() to display the images?

I use display.newImage() to display the images.

Hi @WilerJr,

For dynamic scaling (images), you need to use “newImageRect()”. Do you have the proper guides/resources for this, or should I point you to some URLs?

Brent

Are you using display.newRect() or display.newImageRect() to display the images?

I use display.newImage() to display the images.

Hi @WilerJr,

For dynamic scaling (images), you need to use “newImageRect()”. Do you have the proper guides/resources for this, or should I point you to some URLs?

Brent

“newImageRect()” has not solved the problem…

Hi @WilerJr,

Can you post a few lines of code, showing how you’re placing one of these images?

Thanks,

Brent

background = display.newImage("images/background\_game.png", 320, 480);  

But this is using “newImage()”, not “newImageRect()”… is this a typo?

lol. Big mistake. I’ll change that and bring some news later.

Anyway, the code I posted above is an exception; the others are being called like

background = display.newImage("images/background\_pause.png", image\_width, image\_height);  

where is the exception?
this is still using “newImage()”, not “newImageRect()”. :wink:

Damn it! hahaha

I forgot to change to “newImageRect” on the post. Sorry. But the exception is:

background = display.newImageRect("images/background\_pause.png", image\_width, image\_height);  

Hi @WilerJr,

This is a “duh!” observation this late in the thread… did you actually configure your image suffix values in “config.lua”? I don’t see them there, unless you just didn’t paste that part in…

Brent

I don’t use image suffix…

Hi @WilerJr,

Dynamic image selection goes hand-in-hand with image suffix. You can’t do one without the other. Please read through the guide on how to set all of this up:

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

Take care,

Brent

I think I’ve read somewhere that the images are resized automatically by Corona… But as soon as I can I’ll take a look at the link you posted. Thank you.

Yes, they are resized (well, selected) automatically, but you need to set up the suffix config first, and then name your images properly. It’s all there in the guide. :slight_smile:

What you can about the variety of Android devices’ screen sizes? How can I do image suffix for them? ^^