Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to take screenshot in Mac OS X using Cocoa or C++

Tags:

How to take screenshot programmically of desktop area in Mac OS X ?

like image 392
pirho Avatar asked Sep 02 '08 06:09

pirho


1 Answers

Two interesting options I have seen, but yet to use professionally, are the screencapture utility and a MacFuse demo.

The screencapture utility has been around since 10.2, according to the man page, and could be linked to a Cocoa application by use of NSTask.

The MacFuse demo worked by creating a new screenshot each time a folder was opened, or something like that. The idea being you could write a quick script to access the image when you needed it, without having to have the script actually run on that machine.

But seriously, Apple has some other sample code called "Son of Grab" which uses the new CGWindow API which is pretty awesome.

http://developer.apple.com/samplecode/SonOfGrab/

like image 102
Peter Avatar answered Oct 20 '22 04:10

Peter