Problem saving screenshot on iPhone 5

Hi,

I am trying to take a screenshot to post to Facebook.  I’ve got it all working fine on an iPhone 4 and iPad.  However, on iPhone 5 there is an extra black bar saved to the bottom of the image (see attached screenshot).  I’m using this function:

[lua]display.save(screenshotGroup, “screenshot.jpg”, system.TemporaryDirectory)[/lua] 

Bizarrely, when I view the photo in Finder, my Mac seems to think it is 320 x 568.  However, the image is actually 320 x 672 (the black box has a height of 104).

I’ve also tried display.captureBounds and display.capture.  I think the problem was exactly the same, but if not, it was certainly very similar (black box at the bottom of the image).

Perhaps I’m getting this problem because of the way I’m scaling for iPhone 5:

In config.lua I’m scaling with yAlign set to top:

[lua]application = {
content = {
width = 320,
height = 480,
scale = “letterbox”,
xAlign = “center”,
yAlign = “top”,
fps = 30,

imageSuffix = {
["@2x"] = 2,
["@4x"] = 4,
}

},
}[/lua]

Elsewhere, to adjust for tall screens I set object.y = [number between 0 and 480]*isTall, where isTall is defined by:

[lua]local isTall

if display.actualContentHeight/display.actualContentWidth > 480/320 then
isTall = (320 * display.actualContentHeight)/(display.actualContentWidth*480)
else
isTall = 1
end
[/lua]

It’s weird I’m experiencing this problem, because I don’t think I’ve seen it in the past.  I am using build 1076, and haven’t updated… but I’ve checked my old apps and they’re now experiencing the same issue too.

Hope you can help,

Ed

Update: display.captureScreen() produces a slightly different result - there is still a black box at the bottom of the image that shouldn’t be.  However, the image dimensions are 320 x 568, with the screenshot taking up 320 x 480 (it is still the iPhone 5 screenshot though, so should take up the entire 320 x 568 space… the image has been squished (ie it hasn’t been cropped)).  The black bar occupies the 320 x 88 area at the bottom.

Hi @edmoyse,

Do you have the required iPhone5 “tall” launch image in your project folder? This is an Apple-mandated inclusion and has been for a long time (since release of the original iPhone5, if I recall). Details are contained in this guide, near the bottom:

http://docs.coronalabs.com/guide/distribution/buildSettings/index.html

Best regards,

Brent

Hi Brent,

I do:

Default-568h@2x.png and it’s 640 x 1136.

I have also noticed that in the simulator it launches my 640 x 960 (or possibly 320 x 480) Default.png (or Default@2x.png) for the iPhone 5.  However, when built for device it seems to work fine.

Thanks for the advice, but I think it’s a different issue I’m experiencing - do you have any other suggestions?

Best,

Ed

Update: display.captureScreen() produces a slightly different result - there is still a black box at the bottom of the image that shouldn’t be.  However, the image dimensions are 320 x 568, with the screenshot taking up 320 x 480 (it is still the iPhone 5 screenshot though, so should take up the entire 320 x 568 space… the image has been squished (ie it hasn’t been cropped)).  The black bar occupies the 320 x 88 area at the bottom.

Hi @edmoyse,

Do you have the required iPhone5 “tall” launch image in your project folder? This is an Apple-mandated inclusion and has been for a long time (since release of the original iPhone5, if I recall). Details are contained in this guide, near the bottom:

http://docs.coronalabs.com/guide/distribution/buildSettings/index.html

Best regards,

Brent

Hi Brent,

I do:

Default-568h@2x.png and it’s 640 x 1136.

I have also noticed that in the simulator it launches my 640 x 960 (or possibly 320 x 480) Default.png (or Default@2x.png) for the iPhone 5.  However, when built for device it seems to work fine.

Thanks for the advice, but I think it’s a different issue I’m experiencing - do you have any other suggestions?

Best,

Ed