Image size differs per device

In config.lua, I have set the application’s content width and height to 750 x 1334

The fullscreen images I am using are .jpg files which are 750 x 1334

Basic code:

local setupScreen1 = display.newImage(group1,"FirstSetup1.jpg",375,667) print("height of image: " .. setupScreen1.height)

Running the simulator as iPhone 5, iPhone 6, iPhone 6 Plus, iPad Air, or iPad Pro results in a height of 1334 as expected.

Running the simulator as iPhone 4 or iPad Mini results in a height of 1024, and the image does not fill the screen.

The image is still centered, with (x,y) of (375,667) being the center of the application’s content of 750 x 1334

Can anybody explain this behavior so I can best more forward positioning images within my app’s view on different devices? Thanks so much in advance!

Can you post your config,lua please?

Thanks for answering Rob! Here is the config.lua:

application = { content = { width = 750, height = 1334, fps = 60, }, }

I have the same problem, if you do that it will fill your wole screen

setupScreen1.xScale=display.actualContentWidth/setupScreen1.width setupScreen1.yScale=display.actualContentHeight/setupScreen1.height setupScreen1.x=display.contentCenterX setupScreen1.y=display.contentCenterY

See your other post. 

https://forums.coronalabs.com/topic/65938-displaypixelwidth-displaypixelheight-different-between-simulator-and-device/#entry341446

Rob

Thanks remiduchalard and Rob Miracle!

Adding the letterbox scale did change the size of both display.newImage items and display.newRect items, but not in a way that filled the screen.

The code remiduchalard provided actually made the images smaller, but for this app (portrait app), using that code but flipping the ratio order was what I needed and made the images appear full screen on all devices!

The code I ended up using:

setupScreen1.xScale = display.actualContentWidth/setupScreen1.width setupScreen1.yScale = display.actualContentHeight/setupScreen1.height

I didn’t need these lines:

setupScreen1.x = display.contentCenterX

setupScreen1.y = display.contentCenterY 

**To anybody else reading: obviously this is going to stretch the images to fit the screen and disregard aspect ratio, images or text will be blurry, not recommended for most situations.

Can you post your config,lua please?

Thanks for answering Rob! Here is the config.lua:

application = { content = { width = 750, height = 1334, fps = 60, }, }

I have the same problem, if you do that it will fill your wole screen

setupScreen1.xScale=display.actualContentWidth/setupScreen1.width setupScreen1.yScale=display.actualContentHeight/setupScreen1.height setupScreen1.x=display.contentCenterX setupScreen1.y=display.contentCenterY

See your other post. 

https://forums.coronalabs.com/topic/65938-displaypixelwidth-displaypixelheight-different-between-simulator-and-device/#entry341446

Rob

Thanks remiduchalard and Rob Miracle!

Adding the letterbox scale did change the size of both display.newImage items and display.newRect items, but not in a way that filled the screen.

The code remiduchalard provided actually made the images smaller, but for this app (portrait app), using that code but flipping the ratio order was what I needed and made the images appear full screen on all devices!

The code I ended up using:

setupScreen1.xScale = display.actualContentWidth/setupScreen1.width setupScreen1.yScale = display.actualContentHeight/setupScreen1.height

I didn’t need these lines:

setupScreen1.x = display.contentCenterX

setupScreen1.y = display.contentCenterY 

**To anybody else reading: obviously this is going to stretch the images to fit the screen and disregard aspect ratio, images or text will be blurry, not recommended for most situations.