content scaling weirdness

My artist has exported our images from Illustrator to png24 in 3 different resolutions:

image.png

image@2x.png

image@4x.png

While using display.newImage, things size/space properly but of course it’s always selecting the low-res version and thus is pixelated on the hi-dpi devices.

When I add a config.lua (as specified by Rob in this article) and begin using “newImageRect”, I get this “exploded” effect where all the graphics are HUGE, FUZZY and placed all over the screen – some off-screen.  You can’t even make out the general layout of the UI – it’s just a huge fuzzy mess…(in the simulator) and it gets even messier if I switch to simulator for iPhone 4 or 5

Can anyone tell me what’s causing this or what we need to change??

I’ve tried making her use only EVEN-INTEGER dimensions for height and width.  I’ve turned off anti-aliasing, I’ve exported at several different scale factors…nothing seems to cause it to use the proper image.

All guidance appreciated!

I believe that’s what I’m doing…as above:

  " and begin using “newImageRect”

also, I’m on the latest daily build if that helps…but this was happening on earlier builds as well…

It’s got to be something really silly not hopefully not THAT silly :wink:

Thx

Dewey

What’s size of image.png?

I have multiple images…all showing the same problem…they range in size between .4k and 70k

We used a nearly verbatim version of this script to auto-export them from Adobe Illustrator

Hi @dgaedcke,

When you can, please post how your config.lua looks, and then show at least one of the lines where you place an image on the screen.

Thanks,

Brent

Brent…thanks for helping me track this down!!

my config.lua is IDENTICAL to the config.lua posted by Rob Miracle and linked above in my 1st post.

Here is the code below!  As I said, it works fine when I use newImage, but the simulator display gets really weird when using newImageRect

local ccx = display.contentCenterX

local ccy = display.contentCenterY

local dni = display.newImageRect

local msgBak = dni(‘graph_positive.png’, 0, 0)

msgBak.x = ccx - 100

msgBak.y = ccy

Hi @dgaedcke,

I notice that your width and height settings are both 0. These should be set to the base “@1x” image size, so Corona knows how to scale up (or down) other images based on that.

Best regards,

Brent

Thanks Brent!!  Silly mistake on my part…all my old code (to which I’m returning after a long break) used newImage instead…

So you tell me to use the @1x image size but is that the actual size I see when I look at the image file on disk or do I need to convert those values using some ratio based on the content settings provided in that config.lua provided by Rob Miracle (ref above).  If so, I’m not sure how that’s possible because he uses a different content w & h based on the running device…

I guess I’m answering my own question – I’m supposed to use the w & h of the actual file on disk – right?

– example from Rob’s config.lua

 content =

        {

            width = 360,

            height = 480,

            scale = “letterBox”,

Hi @dgaedcke,

Yes, use the actual pixel size of the “base” image. Then, whichever sizes you decide to use above (or below) that will need to be calculated by you, based on your suffix setup. Many developers just do 1x and 2x (and maybe 4x), but there’s no strict rule on that… you could use 1.5x, 1.895552x, etc. That last example is silly, but I’m just commenting that it’s possible. :slight_smile:

Brent

I believe that’s what I’m doing…as above:

  " and begin using “newImageRect”

also, I’m on the latest daily build if that helps…but this was happening on earlier builds as well…

It’s got to be something really silly not hopefully not THAT silly :wink:

Thx

Dewey

What’s size of image.png?

I have multiple images…all showing the same problem…they range in size between .4k and 70k

We used a nearly verbatim version of this script to auto-export them from Adobe Illustrator

Hi @dgaedcke,

When you can, please post how your config.lua looks, and then show at least one of the lines where you place an image on the screen.

Thanks,

Brent

Brent…thanks for helping me track this down!!

my config.lua is IDENTICAL to the config.lua posted by Rob Miracle and linked above in my 1st post.

Here is the code below!  As I said, it works fine when I use newImage, but the simulator display gets really weird when using newImageRect

local ccx = display.contentCenterX

local ccy = display.contentCenterY

local dni = display.newImageRect

local msgBak = dni(‘graph_positive.png’, 0, 0)

msgBak.x = ccx - 100

msgBak.y = ccy

Hi @dgaedcke,

I notice that your width and height settings are both 0. These should be set to the base “@1x” image size, so Corona knows how to scale up (or down) other images based on that.

Best regards,

Brent

Thanks Brent!!  Silly mistake on my part…all my old code (to which I’m returning after a long break) used newImage instead…

So you tell me to use the @1x image size but is that the actual size I see when I look at the image file on disk or do I need to convert those values using some ratio based on the content settings provided in that config.lua provided by Rob Miracle (ref above).  If so, I’m not sure how that’s possible because he uses a different content w & h based on the running device…

I guess I’m answering my own question – I’m supposed to use the w & h of the actual file on disk – right?

– example from Rob’s config.lua

 content =

        {

            width = 360,

            height = 480,

            scale = “letterBox”,

Hi @dgaedcke,

Yes, use the actual pixel size of the “base” image. Then, whichever sizes you decide to use above (or below) that will need to be calculated by you, based on your suffix setup. Many developers just do 1x and 2x (and maybe 4x), but there’s no strict rule on that… you could use 1.5x, 1.895552x, etc. That last example is silly, but I’m just commenting that it’s possible. :slight_smile:

Brent