Multiple Screenshots, multiple saveImage?

This is probably hopelessly naive, but I’m using the following code to perform a screen capture if space bar is pressed.

void ofApp::keyPressed(int key){
if (key == ’ ') {
ofImage screenShot;
screenShot.grabScreen(0, 0, ofGetWidth(), ofGetHeight());
screenShot.saveImage(“screenshot.png”);
}
}

My question is, is there a way to have multiple outputs so that the screenShot.saveImage saves the image to “screenshot1.png”, “screenshot2.png”, etc? I apologize if this is a stupid question.

You can use ofSaveFrame(). It already has an internal counter that increases every time you save a frame. The counter will be reset if you reset the application, and the saved screenshots will be overwritten.

@m1ngle
See /examples/graphics/imageSaverExample in 098
I hope it will help you!

Thanks, yuma, it was a great help, I was able to put the code for image saver into my video player and it works well now