Taking a picture of the screen, in code

I know there is the little camera at the bottom of the screen while developing your game, but what I am looking for is a way to take a picture of your screen (actually only a piece of the screen) in code while your game is running and then save it to the camera role. Ideally there would be a button that says “Save image” and then the iOS dialogue box confirming you want to save to the camera role comes up.

Does anyone have any ideas?

Part1/ take the picture. You control everything you put on screen. So you can draw it into an image with setcontext(img) when you want.
Part2/ save the picture. Well… For that codea doent have built in function. You have to write it in opjective C if you make an app.

@Jmv38 you can save the picture in codea too using the Class which converts the image to a string, but it’s just a little bit of a mess.

You can’t save the picture to the camera roll from within Codea, but you can save it to Dropbox or Documents via saveImage(<filename>,<image>).

Oh yeah right!

Correct. I really meant you cant save to the camera roll , which was the question.