ofSaveScreen() outputs file with wrong color

#1

Here’s my code:

void ofApp::draw(){
    ofSetColor(255, 0, 0);
    ofDrawRectangle(100, 100, 100, 100);
    ofSaveScreen("test.jpg");
    ofExit();
}

And here’s what the output image “test.jpg” looks like


As you can see, the color of the rectangle is not red but blue.

Is this a bug? I tested this on macOS 10.14.4.


Added: This issue also happens with ofSaveViewport().

#2

ofSaveScreen use rgb with alpha so you need to use png format

ofSaveScreen("test.png");
1 Like