imageSuffix question

Hi guys

this is my config.lua:

application = { content = { width = 320, height = 480, scale = "letterbox", fps = 60, imageSuffix = { ["@2x"] = 1.5, ["@4x"] = 3, }, }, notification = { iphone = { types = { "badge", "sound", "alert" }, }, }, }

so when I then created an image I do something like:

local ball = display.newImageRect( "ball.png", 30, 30 ) ball:translate(160, 250)

and in my folder I have the following files:

  1. “ball.png”          (30x30)

  2. “ball@2x.png”   (60x60)

  3. “ball@4x.png”   (120*120)

Everything works as expected.

My question is:

The base resolution (30 * 30) is required? I did some tests and it seems that no device in the simulator uses it.

I want the images to be optimized for all devices.

However, if there are images that are not needed, I do not want to occupy useless space in my apk…

Thanks in advance

If your only targeting iOS, then no, you shouldn’t need the base images. There are no iOS devices that are not at least 640px wide screen wise.  If you want to support Android, there are some people on older devices that may still have a screen 480px or less.

But it should downsample the @2x images with a performance hit (on an already slow device). You can look in the borderless skins and pick some of the lower resolution devices to test against.

Rob

Thanks Rob.

Sorry but I’m not a native speaker I did not understand the second part…

I’m also targeting at Android. 

if I understand correctly you say that in any case the older devices should not have problems converting "@ 2x…

right?

It depends on the device. Asking the device to take a large image and make it smaller takes time and you are loading larger images which take up more memory. It’s hard to say how it will impact low power devices because larger images like backgrounds will take more resources to resize than a small button.

If you do not provide base images and your device is low enough resolution to want to use the base images, then it will give you a runtime error. 

Rob

If your only targeting iOS, then no, you shouldn’t need the base images. There are no iOS devices that are not at least 640px wide screen wise.  If you want to support Android, there are some people on older devices that may still have a screen 480px or less.

But it should downsample the @2x images with a performance hit (on an already slow device). You can look in the borderless skins and pick some of the lower resolution devices to test against.

Rob

Thanks Rob.

Sorry but I’m not a native speaker I did not understand the second part…

I’m also targeting at Android. 

if I understand correctly you say that in any case the older devices should not have problems converting "@ 2x…

right?

It depends on the device. Asking the device to take a large image and make it smaller takes time and you are loading larger images which take up more memory. It’s hard to say how it will impact low power devices because larger images like backgrounds will take more resources to resize than a small button.

If you do not provide base images and your device is low enough resolution to want to use the base images, then it will give you a runtime error. 

Rob