Ofsaveframe() resolution

Hi all, my monitor is 2880 x 1800. ofsaveframe() is really convenient, but it saves images at exactly half of this resolution. Is there any way around this?

hey, can you show the code you are using?

here you have a little code to capture a frame:

//take screenshot
		{
			ofImage img;
			img.grabScreen(0, 0, ofGetWidth(), ofGetHeight());
			string _pathFolder = "captures/";
			string _fileName = "snapshot_" + ofGetTimestampString() + ".png";
			string _pathFilename = ofToDataPath(_pathFolder + _fileName, true);//bin/data
			bool b = img.save(_pathFilename);
			if (b) cout << __FUNCTION__ << " Saved screenshot successfully: " << _pathFilename << endl;
			else cout << __FUNCTION__ << " Error saving screenshot:" << _pathFilename << endl;
		}

Ah… this is good, but has the same issue as simply using ofSaveFrame(). If I use ofGetWidth()/ofGetWidthHeight() and run my app at full screen it takes the screenshot at half the resolution of my monitor. If I manually enter the resolution it takes the screenshot at the correct dimensions it only fills a portion of it.

Huh. FWIW, mine produces full-size screenshots, but my monitor is only 1920x1080… hmm.

At least, on Windows. What OS are you seeing this problem on?

Mac

Ok, then I think it is because it is a Retina display, and OF (at least by default) running at half the Retina resolution.

This thread might provide the answer:

other related threads:


1 Like

Thank you so much, enabling high resolution in the .plist file did the trick!

1 Like

Unfortunately, it is still not exactly the same as taking a screenshot manually. The dimensions are correct but the “resolution” (not sure how that’s different, technically) is still halved. This causes issues when I compile the frames into a video, despite the screenshots being apparently indistinguishable. image

After compiling to video (using quicktime) there is this issue: image . It should be perfectly straight but the border is blurred. I suspect this is caused by the halved resolution.

Manual screenshot compiled to video with perfectly straight borders:
image

Oh, huh “resolution” 72x72 would seem to mean something is thinking resolution for printing is relevant to your screenshot - i.e. 72 dpi dots per INCH so I imagine something is trying to be helpful by compressing and/or discarding image data higher than that precision.