Quantcast
Channel: bugs, errors - openFrameworks
Viewing all articles
Browse latest Browse all 636

ofImage grabScreen distorting colours

$
0
0

@jared wrote:

Hi Everyone,

I have been running some old code that I previously wrote for v0.9.8, in v0.11.0, and have noticed some issues around the use ofImage.grabScreen(), ofImage.resize() and ofImage.getPixels().

When I grab the screen using ofImage.grabScreen() and then resize it using ofImage.resize(), the colours are getting distorted. It seems like red and blue have been swapped. Also, the image is cropped/corrupted towards the bottom (see example below).

I’ve isolated the issue in an example project (based on emptyExample) which has the following code:

void ofApp::setup(){
    image.load("image.jpg");
}
void ofApp::draw(){
    image.draw(0, 0);
}
void ofApp::keyReleased(int key){
    ofImage imageResized;
    imageResized.grabScreen(0, 0, 678, 1024);
    imageResized.resize(424, 640);
    imageResized.save("image_resized.jpg");
}

This is the resulting resized image (after doing ofImage.grabScreen() and ofImage.resize()):


(The original is here: https://unsplash.com/photos/FsXq3xu72bs)

I’d appreciate any ideas about what might be going wrong or how I can fix this.

Jared

Posts: 2

Participants: 2

Read full topic


Viewing all articles
Browse latest Browse all 636

Trending Articles