Problem with screen shots

Hi all,

I have a problem with my screen shots. In fact, the screenshots is made, then I save it and finally, I want to share it.

But, the problem is that, once I reuse the screenshot after it has been saved, it appears that only a small portion of the image has been saved and is displayed although I would like the whole picture.

Here is my code:

local image = display.captureScreen(false) local baseDir = system.DocumentsDirectory media.save( image, "image.png", baseDir ) image:removeSelf() image = nil local image2 = display.newImage( "image.png", system.DocumentsDirectory ) image2.x = 540 image2.y = 960

The problem is that only a quarter of the image is displayed.

Thanks in advance

Can you try using “display.save()” instead of “media.save()”?

https://docs.coronalabs.com/api/library/display/save.html

Best regards,

Brent

Hi,

Thanks for your reply.

I tried using “display.save()” instead of “media.save()” but I still get a quarter of the image.

Best regards,

Pierre

Did you try placing the image in the screen center before saving it to a file? Something like this:

[lua]

local image = display.captureScreen(false)

image.x = display.contentCenterX

image.y = display.contentCenterY

local baseDir = system.DocumentsDirectory

– Now save the image…

[/lua]

I just tried this and it works perfectly.

Thank you very much

Can you try using “display.save()” instead of “media.save()”?

https://docs.coronalabs.com/api/library/display/save.html

Best regards,

Brent

Hi,

Thanks for your reply.

I tried using “display.save()” instead of “media.save()” but I still get a quarter of the image.

Best regards,

Pierre

Did you try placing the image in the screen center before saving it to a file? Something like this:

[lua]

local image = display.captureScreen(false)

image.x = display.contentCenterX

image.y = display.contentCenterY

local baseDir = system.DocumentsDirectory

– Now save the image…

[/lua]

I just tried this and it works perfectly.

Thank you very much