Quantcast
Channel: beginners - openFrameworks
Viewing all articles
Browse latest Browse all 4929

Wrong color saved when using ofImage.save jpeg after using ofImage.grabscreen within v0.10.0

$
0
0

@takayuki wrote:

version0.10.0, win10, visualstudio 2017

I tried screen capture.

ofImage image;
image.allocate(1080, 1920, OF_IMAGE_COLOR);
image.grabScreen(0, 0, 1080, 1920);
image.save("screenshot/tmp/last.jpg", OF_IMAGE_QUALITY_LOW);

As a result, the image was saved with R and B replaced with each other.
So I rewrote the code of ofGLRenderer.cpp.

void ofGLRenderer::saveScreen(int x, int y, int w, int h, ofPixels & pixels){
	int sh = getViewportHeight();


	#ifndef TARGET_OPENGLES
	if(isVFlipped()){
		y = sh - y;
		y -= h; // top, bottom issues
	}
	auto pixelFormat = OF_PIXELS_BGRA;

change this.

auto pixelFormat = OF_PIXELS_RGB;

Then, this problem was solved.

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 4929

Trending Articles