Save image to phone

@Joshua Quick , please help me. I have a big problem.
I need to save an image to file from the sceen. I use [lua]display.save()[/lua]

display.contentWidth is 480
display.contentHeight is 800
[lua]local image = display.newImageRect( “my_image.jpg”, 480, 800 )
image.x = display.contentCenterX
image.y = display.contentCenterY

local group = display.newGroup()
group:insert(image)

display.save( group, “image1.jpg”, system.DocumentsDirectory )[/lua]
But it does not save a 480x800 image. The size of the saved image is 240x400.
I deleted the config.lua, so nothing content scaling.
Please tell me how to save a full size image. [import]uid: 138389 topic_id: 15661 reply_id: 117740[/import]

The saved image is going to be in pixels, not in content coordinates. That means the capture image will vary in size on screens with different resolutions. This is by design.

I recommend that you display the capture image via [lua]display.newImageRect()[/lua] and feed that function the width and height that you want the image object to have onscreen. This way Corona will automatically scale the capture image for you when displaying it.

Also… why are you capturing that temporary group object that only has 1 image object in it? That seems unnecessary. There’s no point in capturing a group unless you want to capture a collection of objects in one shot. Just give the [lua]display.capture()[/lua] function the one image object that you want to capture directly. Much easier and less trouble. [import]uid: 32256 topic_id: 15661 reply_id: 117784[/import]

@Joshua Quick, [text] The saved image is going to be in pixels, not in content coordinates. [/text]
I don’t understand this yet thing but I displayed the save image like you said and it work perfect.
I changed the code

local image = display.newImageRect( "image.jpg", 480, 800)  
image.x = display.contentCenterX  
image.y = display.contentCenterY  
display.save( image, "image1.jpg", system.DocumentsDirectory )  

You said I can use display.capture()
But it saves the images to “photo library” and not to “system.DocumentsDirectory”.
I need this to make and save Thumbnails of very big photos.
You helped me a lot. I was blocked here. Many thanks. [import]uid: 138389 topic_id: 15661 reply_id: 117793[/import]

My mistake. I meant [lua]display.save()[/lua]. Sorry to confuse you.

The code you are showing up above is perfect! Glad I could help. [import]uid: 32256 topic_id: 15661 reply_id: 117795[/import]

Joshua,
I was going through this post and I require help regarding something similar so I thought of posting in this thread instead of making a new one.

I’m taking pictures with the camera and saving them using display.save. The images get saved in the documentsDirectory alright, but I can’t seem to locate them when I run the app on my IPad. Where are these images saved?

Secondly, I tried using display.capture. It saves the images on my desktop but names them as picture1, picture2 and so on. While I want to save the names of pictures as date and time stamp. How can i do that?
Thanks. [import]uid: 175611 topic_id: 15661 reply_id: 136336[/import]

iOS sandboxes your app’s directories (such as Documents) and does not allow other apps or your PC to access its files. At least not by any official means. If you want to transfer your file to your PC, then what you can do is have your app e-mail it to yourself via our [lua]native.showPopup(“mail”)[/lua] API as documented via the link below. This API allows you to attach this file.
http://docs.coronalabs.com/api/library/native/showPopup.html

Regarding the [lua]display.catpure()[/lua] function, it was designed to save to the platform’s Photo Gallery, making it publicly available. This would make your screenshot available to your PC via iTunes. However, iOS does not allow you to set the file name of the photo. That is an iOS limitation, which is why our API does not allow you to set it. If you absolutely must set the file name, then your only option is the [lua]display.save()[/lua] function, but then it is saved to your app’s sandbox. Each has their own limitations, but that’s just the way Apple made it.

Anyways, I hope this helps.
[import]uid: 32256 topic_id: 15661 reply_id: 136383[/import]

Yes, that was well explained and helpful. Thanks Joshua. [import]uid: 175611 topic_id: 15661 reply_id: 136556[/import]

Joshua,
I was going through this post and I require help regarding something similar so I thought of posting in this thread instead of making a new one.

I’m taking pictures with the camera and saving them using display.save. The images get saved in the documentsDirectory alright, but I can’t seem to locate them when I run the app on my IPad. Where are these images saved?

Secondly, I tried using display.capture. It saves the images on my desktop but names them as picture1, picture2 and so on. While I want to save the names of pictures as date and time stamp. How can i do that?
Thanks. [import]uid: 175611 topic_id: 15661 reply_id: 136336[/import]

iOS sandboxes your app’s directories (such as Documents) and does not allow other apps or your PC to access its files. At least not by any official means. If you want to transfer your file to your PC, then what you can do is have your app e-mail it to yourself via our [lua]native.showPopup(“mail”)[/lua] API as documented via the link below. This API allows you to attach this file.
http://docs.coronalabs.com/api/library/native/showPopup.html

Regarding the [lua]display.catpure()[/lua] function, it was designed to save to the platform’s Photo Gallery, making it publicly available. This would make your screenshot available to your PC via iTunes. However, iOS does not allow you to set the file name of the photo. That is an iOS limitation, which is why our API does not allow you to set it. If you absolutely must set the file name, then your only option is the [lua]display.save()[/lua] function, but then it is saved to your app’s sandbox. Each has their own limitations, but that’s just the way Apple made it.

Anyways, I hope this helps.
[import]uid: 32256 topic_id: 15661 reply_id: 136383[/import]

Yes, that was well explained and helpful. Thanks Joshua. [import]uid: 175611 topic_id: 15661 reply_id: 136556[/import]