<p>How to take screenshot programmically of desktop area in Mac OS X ?</p>

[{'answer_id': 38988, 'author': 'Andy Brice', 'author_id': 455552, 'author_profile': 'https://Stackoverflow.com/users/455552', 'pm_score': 2, 'selected': False, 'text': '<p>Qt includes an example screenshot app in examples\\desktop\\screenshot. Qt works on a range of platforms, including MacOSX.</p>\n\n<p><a href="http://trolltech.com/products/qt/" rel="nofollow noreferrer">http://trolltech.com/products/qt/</a></p>\n'}, {'answer_id': 39005, 'author': 'stevechol', 'author_id': 2981, 'author_profile': 'https://Stackoverflow.com/users/2981', 'pm_score': -1, 'selected': False, 'text': '<p>If you consider REALbasic, this is extremely easy to do with RB and the MBS Plugins.  I\'ve just written an application that does timed screenshots using RB and the MBS Plugins.  You can read about it here:  <a href="http://tektalkin.blogspot.com/2008/08/screenaudit-for-mac-osx.html" rel="nofollow noreferrer">http://tektalkin.blogspot.com/2008/08/screenaudit-for-mac-osx.html</a></p>\n'}, {'answer_id': 40519, 'author': 'Peter', 'author_id': 4314, 'author_profile': 'https://Stackoverflow.com/users/4314', 'pm_score': 4, 'selected': False, 'text': '<p>Two interesting options I have seen, but yet to use professionally, are the screencapture utility and a MacFuse demo.</p>\n\n<p>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.</p>\n\n<p>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.</p>\n\n<p>But seriously, Apple has some other sample code called "Son of Grab" which uses the new CGWindow API which is pretty awesome. </p>\n\n<p><a href="http://developer.apple.com/samplecode/SonOfGrab/" rel="noreferrer">http://developer.apple.com/samplecode/SonOfGrab/</a></p>\n'}, {'answer_id': 67767, 'author': 'pestophagous', 'author_id': 10278, 'author_profile': 'https://Stackoverflow.com/users/10278', 'pm_score': 1, 'selected': False, 'text': '<p>The following might be helpful if you are attempting to accomplish this with C++ or python.  Also, this would be even more helpful in the case that you want your programmatic method to be cross-platform portable. (Windows, Linux, Mac osx, and even beyond)</p>\n\n<p>An earlier response mentions QT.</p>\n\n<p>In the same way that QT will allow you to capture and save a screenshot, so does another "competing" framework, namely wxWidgets.  wxWidgets is a C++ framework, but it also provides python bindings via wxPython.</p>\n\n<p>To read more, use the following link, search the book for <strong>wxScreenDC</strong> and choose "Page 139" from the list of pages that match the search:</p>\n\n<p><a href="http://books.google.com/books?id=CyMsvtgnq0QC&amp;vq=%22accessing+the+screen+with+wxScreendc%22" rel="nofollow noreferrer">http://books.google.com/books?id=CyMsvtgnq0QC&amp;vq="accessing+the+screen+with+wxScreendc"</a></p>\n'}, {'answer_id': 67833, 'author': 'Community', 'author_id': -1, 'author_profile': 'https://Stackoverflow.com/users/-1', 'pm_score': 4, 'selected': False, 'text': '<p>One way of going about doing this would be to use NSTask in conjuction with the \'screencapture\' command line command.</p>\n\n<p>For example:</p>\n\n<pre><code>NSTask *theProcess;\ntheProcess = [[NSTask alloc] init];\n\n[theProcess setLaunchPath:@"/usr/sbin/screencapture"];\n// use arguments to set save location\n[theProcess setArguments:@"blahblah"];\n[theProcess launch];\n</code></pre>\n\n<p>The you could open up the file wherever you told it to be saved, process it, and then delete it as needed. Obviously stopgap, but it would work.</p>\n'}, {'answer_id': 77506, 'author': 'Community', 'author_id': -1, 'author_profile': 'https://Stackoverflow.com/users/-1', 'pm_score': 3, 'selected': False, 'text': '<p>If you\'re fine with Leopard compatibility, there\'s a very powerful new CGWindow API that will let you grab screen shots, window shots, or composites of any range of window layers. </p>\n\n<p><a href="http://developer.apple.com/samplecode/SonOfGrab/" rel="noreferrer">http://developer.apple.com/samplecode/SonOfGrab/</a></p>\n'}]
['https://Stackoverflow.com/questions/38934', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/3911/']