DZone Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

Snippets has posted 5883 posts at DZone. View Full User Profile

Get A Screenshot

04.07.2005
| 6968 views |
  • submit to reddit
        
screencapture -S /tmp/screengrab.pdf ; sips -s format png /tmp/screengrab.pdf --out /tmp/screengrab.png; open /tmp/screengrab.png
    

Comments

Snippets Manager replied on Wed, 2006/08/16 - 10:06am

You can indeed choose different formats to save to automatically. # Whole screen saved to png screencapture -S -t png /tmp/screenshot.png # Whole screen saved to png and then opened in Preview screencapture -S -t png -P /tmp/screenshot.png # Or if you have something else set to open PNG's by default and want to use that: screencapture -S -t png /tmp/screenshot.png && open /tmp/screenshot.png Check out `man screencapture` for other options.

Snippets Manager replied on Mon, 2012/05/07 - 1:11pm

It's not code, but don't forget.. Cmd+Shift+4 is a built-in method of taking PNG screenshots in Tiger. As is Cmd+Shift+3. 'screencapture' can also capture to different formats, not just PDF.. I think it may even go straight to PNG if you choose to.