Can't get screen capture to work

I’m trying to take a screenshot within openframeworks but I can’t seem to get anything to work. I have the following code:

ofImage screenImg;  
	screenImg.allocate(ofGetScreenWidth(), ofGetScreenHeight(), OF_IMAGE_COLOR);  

There is a drop in framerate when the above code is executed but it doesn’t seem to save a file?

This is on snow leopard with OF 6.1 and xcode.

I can draw back the screenImg object fine so the problem must be with the saveImage function, I can’t see any errors printed to the console when I run it though.

Bump still having this problem.

Hi, i also tried to capture an image from OF’s background, and i just used these two lines:

ofImage savedBg;


however i’m just catching the BG by drawing things like beziers… hope this info helps you.

Hello again. Recently I found these two functions in the openframeworks page: ofSaveScreen(String filename) and ofSaveFrame(). I haven’t used them yet, however I think they might work well.

Here’s the documentation:, you can use CTRL+F to find them, or just scroll.

As long as the screen capture code is outside of the draw() function it will work.

There also seems to be an example now for this, openFrameworks/examples/graphics/imageSaverExample