Capturing an image of the whole screen

Is there a way to capture an image of the whole screen and save it to the “Documents” sprite pack?

The only way to do this would be to draw everything you’re drawing on the screen in a setContext() enclosure to an image then use saveImage(image). I do this in my game to draw post processing effects.

ie something like this

img=image(WIDTH,HEIGHT)
setContext(img)
--drawing code here
setContext()
saveImage("Documents:ImageName",img)

What does clearing the setContext() do?

EDIT: Never mind, I figured it out.

Thanks for all your help guys!