Saving images from a camera to a file

I wish to setup two cameras on an actor however I don’t want to display the view from these cameras to user. The sole purpose of these cameras is to capture view from them at some interval and save it directly to jpg (or other) format. Can this be done? Any sample code would be appreciated!