Screenshot without GUI

Hey guys,

im trying to make screenshots using ofImage.grabbScreen() and ofImage.saveImage() but cant seem to figure out how to save them not showing gui (im using official addon ofxGui). I tried making bool variable that would stop gui from drawing for a frame when i press the button “save screenshot” but that doesnt work. Im a bit stuck here, any help would be very much appreciated.

Second issue i have is resolution of screeshots. Im drawing thin polylines but screenshots seem to have problem of displaying them, they are kind of dashed. Im enclosing screenshot:

Is there any way how to go about it? Thanks a lot in advance :slight_smile:

you can use ofFbo with setting numSample (maximum 16), which is default value 0.

drawing something to fbo in update().
draw that fbo and GUI in draw(). it shown on screen.

you can save that fbo to image, without GUI.

or just hide the GUI with a keystroke

thanks guys for your replies, i figured out that problem with resolution of screenshots is somehow connected to the os because i tried making screenshots on mac and the problem did not occur. Dont know why…

Draw the image inside an fbo for example,

fbo.begin();
//All draw code goes here
fbo.end();

in your draw(), draw the gui and the fbo.

fbo.draw();
gui.draw();

And saving you can do with the following code:

    if(save){
        ofPixels pix;
        fbo.readToPixels(pix);
        ofSaveImage(pix, fileName + ofToString(ofGetFrameNum()) + ".png", OF_IMAGE_QUALITY_BEST);
    }

I’ve been using this for the last few weeks without any issue. My fileName string variable is declared as a global variable and set in setup but you can omit that.

1 Like