Automatic downscale and image resolutions

Hi all,

I´m just wondering about down scale with corona.

If I create images with e.g. Paint.net or Photoshop and I save my image in 2048 × 1536, i would support IPad Retina resolution.

Now I add the image with display.newImageRect. The image should be down scaled automatically by corona.

As far as I understand, the preferred way is to save my image in different resolutions and a prefix to the image name (@2x, @4x,…).

So I would save my image with photoshop in 1024 x 768 and in 512 x 384.

Now I have:

image@4x.png --> 2048 x 1536

image@2x.png --> 1024 x 768

image.png --> 512 x 384

Corona will now use the preferred image dependent on the device resolution.

But if I only save my image in 2048 x 1536 as image.png, corona will downscale my image automatically, isn´t it?

So why should I save my images in different resolutions if corona does that automatically?

Thanks for you help and best regards,

Alex

Because using those high resolution images on smaller devices with less memory will increase the memory used and you could run into performance issues or out of memory altogether.  That’s my understanding.

As well, the scaling of images works fairly well in Corona, but it isn’t perfect. So if your image has a lot of fine lines in it, they will likely be lost in the downconversion.  Creating individual images allows you to be sure that the user will see the image you want them to see, versus having it manipulated on the device.

@thedog hit the nail on the head.  A 2048x1536 image is actually a 2048x2048x4 texture with regards to memory or 16MB of memory.  The 1024x768 is a 1024x1024x4 or a 4MB image.  In other words, your @4x image is taking up 4X the memory of the @2X image.  The 512x384 is only 1MB of memory. 

If you’re on an older device, like an iPad 2, you have less memory to work with.  Those @4X images add up in hurry.  Also it takes CPU/GPU time to resize the images on the fly and the older the device the slower the CPU and GPU are so you take a hit there too.  Of course, the trade off is more disc space used by the app and a longer download time, but…

Rob

Hi! 

What scale factors do you use for this setup in config.lua?

If I care to support small screens, I use 1.5x for @2x and 3.0 for @4x images.

Because using those high resolution images on smaller devices with less memory will increase the memory used and you could run into performance issues or out of memory altogether.  That’s my understanding.

As well, the scaling of images works fairly well in Corona, but it isn’t perfect. So if your image has a lot of fine lines in it, they will likely be lost in the downconversion.  Creating individual images allows you to be sure that the user will see the image you want them to see, versus having it manipulated on the device.

@thedog hit the nail on the head.  A 2048x1536 image is actually a 2048x2048x4 texture with regards to memory or 16MB of memory.  The 1024x768 is a 1024x1024x4 or a 4MB image.  In other words, your @4x image is taking up 4X the memory of the @2X image.  The 512x384 is only 1MB of memory. 

If you’re on an older device, like an iPad 2, you have less memory to work with.  Those @4X images add up in hurry.  Also it takes CPU/GPU time to resize the images on the fly and the older the device the slower the CPU and GPU are so you take a hit there too.  Of course, the trade off is more disc space used by the app and a longer download time, but…

Rob

Hi! 

What scale factors do you use for this setup in config.lua?

If I care to support small screens, I use 1.5x for @2x and 3.0 for @4x images.