I am trying to do a screen capture on OS X. My solution works properly on macbook pro. But I am facing some problems on Retina displays.
I try to get the current resolution using CGDisplayPixelsHigh/CGDisplayPixelsWide
. It returns the correct resolution (the one I see in Preferences) on Retina but the image returned by CGDisplayCreateImage
gives an image of double the resolution.
This is the code I am using
int activeDisplay;
size_t screenX, screenY;
activeDisplay = CGMainDisplayID();
screenY = CGDisplayPixelsHigh(activeDisplay);
screenX = CGDisplayPixelsWide(activeDisplay);
CGImageRef image = CGDisplayCreateImage(activeDisplay);
Is there a way to capture an image of the resolution I am seeing in Preferences in Retina displays? Also can some one explain why this is happening?