Can Corona add @2x to a base image?

Hello,

I have 3 images one regular named one one with @2x and one with @4x.

I want the ipad to use @2x as the base image and the @4x as the retina image.

Can I use the regular filename without the @2x and have the config.lua add the @2x if scale==1

["@2x"] = 1

It works for the @4x, but it keeps using my base image as the image for the regular ipad.

I really don’t want to duplicate all the @2x and rename them -ipad instead of having the @2x. This will result in more images and is just a dumb solution.

[lua]

if system.getInfo(“model”) == “iPad” then

    

    application = {

    content = {

            width = 768,

            height = 1024,

            scale = “letterbox”, 

            

            fps = 30,

            

            imageSuffix = {

                ["@2x"] = 1,

                ["@4x"] =2,

            },

            {

                launchPad = false,

            }

            

    }

    }

end

[/lua]

Ok, only solution I can find to make this work is change the width and height to 767,1023 instead of 768,1024

Visually it is the same. But still feels like a hack.

I don’t understand.  If you are only targeting the iPad by setting the content area to 768x1024, then why aren’t your normal iPad images named as base.png and then the Retina ones named as as base@2x.png?

If the @2x images are for the iPad and the @4x images are for Retina iPad, what are the base images for?

Cause my ipad images are my iphone retina images. The retina size is more than big enough to be used for the regular ipad.

This way I only need 3 sizes instead of 4. 

regular iphone (as 3gs could still be used I think. )

iphone retina

ipad regular

ipad retina

Oh, sorry, I missed that you were doing detection.  Which can get a little complicated.

I would review Rob’s updated tutorial here:

https://coronalabs.com/blog/2013/09/10/modernizing-the-config-lua/

(It includes a link back to his original ultimate config.lua tutorial that will explain how to better size things when doing detection.)

I think the part you are misunderstanding about this process of having multiple content definitions is that the content sizes you pick need to work with the scaling images you provide.  It can get confusing.   :slight_smile:

I read it, but part of it is of no use to me. It uses the iPhone as a base size and scales up for the ipad. We have a different layout for the iPad. It takes the Android route and goes one sizes fits well enough for all.

The problem I am having here is that Corona uses the base image even though I am asking it to use a different image for the base size of 1.

Instead of changing the width and height, I’d assume that you could change the imageSuffix threshold for @2x to something less than 1 to force it to use the “@2x” extension. What happens if you try something like 0.9 instead of 1?

It doesn’t accept that. 

I tried several options. It seems it wants the 1x scaling to be the original named file in your code.

Changing the width and height by one pixel solved it, but it is not a clean solution. 

Hi Juf Jannie,

Which “set” is your base “1x” size? The iPad/iPhone Retina set, to fit around that 768 x 1024 size? Remember that you can work backwards toward <1 scaling percentages, not just upwards from 1 (you probably already knew this though).

Basically, if your situation is like this:

iPhone 3GS size

iPad1&2, iPhone4/5 --the “1x” base size

iPad Retina

Then a config.lua setup should be possible, since I’ve done an app that works along those lines. :slight_smile:

Brent

This solves it. I knew I could go lower than 1 as I used that for Android sometimes. Just kept clinging to the 3gs as my base. Guess my brain wasn’t working for me this time.

For the next apps using the ipad as a base will indeed solve the problems.

Exactly what I was looking for a nice clean hack free solution. My next app is grateful.

Ok, only solution I can find to make this work is change the width and height to 767,1023 instead of 768,1024

Visually it is the same. But still feels like a hack.

I don’t understand.  If you are only targeting the iPad by setting the content area to 768x1024, then why aren’t your normal iPad images named as base.png and then the Retina ones named as as base@2x.png?

If the @2x images are for the iPad and the @4x images are for Retina iPad, what are the base images for?

Cause my ipad images are my iphone retina images. The retina size is more than big enough to be used for the regular ipad.

This way I only need 3 sizes instead of 4. 

regular iphone (as 3gs could still be used I think. )

iphone retina

ipad regular

ipad retina

Oh, sorry, I missed that you were doing detection.  Which can get a little complicated.

I would review Rob’s updated tutorial here:

https://coronalabs.com/blog/2013/09/10/modernizing-the-config-lua/

(It includes a link back to his original ultimate config.lua tutorial that will explain how to better size things when doing detection.)

I think the part you are misunderstanding about this process of having multiple content definitions is that the content sizes you pick need to work with the scaling images you provide.  It can get confusing.   :slight_smile:

I read it, but part of it is of no use to me. It uses the iPhone as a base size and scales up for the ipad. We have a different layout for the iPad. It takes the Android route and goes one sizes fits well enough for all.

The problem I am having here is that Corona uses the base image even though I am asking it to use a different image for the base size of 1.

Instead of changing the width and height, I’d assume that you could change the imageSuffix threshold for @2x to something less than 1 to force it to use the “@2x” extension. What happens if you try something like 0.9 instead of 1?

It doesn’t accept that. 

I tried several options. It seems it wants the 1x scaling to be the original named file in your code.

Changing the width and height by one pixel solved it, but it is not a clean solution. 

Hi Juf Jannie,

Which “set” is your base “1x” size? The iPad/iPhone Retina set, to fit around that 768 x 1024 size? Remember that you can work backwards toward <1 scaling percentages, not just upwards from 1 (you probably already knew this though).

Basically, if your situation is like this:

iPhone 3GS size

iPad1&2, iPhone4/5 --the “1x” base size

iPad Retina

Then a config.lua setup should be possible, since I’ve done an app that works along those lines. :slight_smile:

Brent

This solves it. I knew I could go lower than 1 as I used that for Android sometimes. Just kept clinging to the 3gs as my base. Guess my brain wasn’t working for me this time.

For the next apps using the ipad as a base will indeed solve the problems.

Exactly what I was looking for a nice clean hack free solution. My next app is grateful.