Android saves tiny images

I’ve been using display.save to save on-screen images created by my devices camera. This works excellently on iOS devices, but on all Android devices with which I have tested, the images are being saved as minuscule versions, even when the image takes up the entire screen. This has not been the case in the past, but started happening with recent builds of corona. Any ideas why this might be happening? 

 

I’m also using the following code, and have found that the images saved on Android are much smaller than their iOS counterparts:

 

[lua]local path = system.pathForFile(“recentphoto.png”, system.DocumentsDirectory)

local image1 = io.open(path, “r”)

local content = image1:read("*a")

local stringImage = mime.b64(content)[/lua]

Might this indicate a difference in how mime.b64 works on Android? Or in how io.open/read works? Or is it the display.save function?

It is critical that I solve this issue, as this is the main feature of my application. Any help would be much appreciated. 

There was a bug in mime.b64() that only encoded the first part of the data, but I thought that had been fixed.  As a test, there are other b64 encoding routines floating out there that you can try instead of the one in the mime library. 

You might also want to change this:

local image1 = io.open(path, “r”)

to this:

local image1 = io.open(path, “rb”)

 

to make sure you’re in “Binary” mode.

Rob

Hi Rob,

After further testing, I’ve determined that the problem is definitely with display.save(). The problem also occurs with display.capture(). I’ve tried the following code, which displays the aforementioned tiny images:

[lua]thePhoto = display.capture(image, {saveToPhotoLibrary=true, isFullResolution=true})[/lua]

Can you file a bug report (make sure to include your build.settings and config.lua).  Engineering needs this information.

Thanks

Rob

I’ve submitted a bug report. What is strange is that the problem only occurs when I have the following code implemented:

[lua]local bg = display.newImageRect(“images/Background.png”, display.contentWidth, display.contentHeight)

bg.x = display.contentWidth/2

bg.y = display.contentHeight/2

    

local rr = display.newImageRect(“images/Back.png”, display.contentWidth - 10, display.contentHeight - 25)

rr.x = display.contentWidth/2

rr.y = display.contentHeight/2 + 13

takePicGroup:insert(bg)

takePicGroup:insert(rr)[/lua]

What does this have to do with the camera function, I wonder?

After further testing, I’ve determined that if any display.newImageRect objects are displayed on the screen during the display.save() call, then the saved image is tiny. If not, then the saved image is fine. 

Can you make sure you reply to your submission email with this additional information.  It will be helpful for the engineers.

Thanks

Rob

There was a bug in mime.b64() that only encoded the first part of the data, but I thought that had been fixed.  As a test, there are other b64 encoding routines floating out there that you can try instead of the one in the mime library. 

You might also want to change this:

local image1 = io.open(path, “r”)

to this:

local image1 = io.open(path, “rb”)

 

to make sure you’re in “Binary” mode.

Rob

Hi Rob,

After further testing, I’ve determined that the problem is definitely with display.save(). The problem also occurs with display.capture(). I’ve tried the following code, which displays the aforementioned tiny images:

[lua]thePhoto = display.capture(image, {saveToPhotoLibrary=true, isFullResolution=true})[/lua]

Can you file a bug report (make sure to include your build.settings and config.lua).  Engineering needs this information.

Thanks

Rob

I’ve submitted a bug report. What is strange is that the problem only occurs when I have the following code implemented:

[lua]local bg = display.newImageRect(“images/Background.png”, display.contentWidth, display.contentHeight)

bg.x = display.contentWidth/2

bg.y = display.contentHeight/2

    

local rr = display.newImageRect(“images/Back.png”, display.contentWidth - 10, display.contentHeight - 25)

rr.x = display.contentWidth/2

rr.y = display.contentHeight/2 + 13

takePicGroup:insert(bg)

takePicGroup:insert(rr)[/lua]

What does this have to do with the camera function, I wonder?

After further testing, I’ve determined that if any display.newImageRect objects are displayed on the screen during the display.save() call, then the saved image is tiny. If not, then the saved image is fine. 

Can you make sure you reply to your submission email with this additional information.  It will be helpful for the engineers.

Thanks

Rob