Terminal Tip: 6 easy ways to capture your screen
OS X's built in screencapture command provides a simple command-line utility to snap images of your desktop. It offers quite a few options and many of them do not quite work as advertised. Even the manual page admits that screencapture is "not very well documented to date".
To make it easier for you to jump in and get started with screencapture, here are six convenient already-tested variations that you can copy, paste and use. Consider adding these capture methods to shell scripts, to system calls from AppleScript or just running them directly from the command line as needed.
1. Capture your primary screen as a (default) png file.
% screencapture ~/Desktop/screencap.png
2. Capture your primary screen as a jpeg (-tjpeg), including the cursor (-C)% screencapture -C -tjpeg ~/Desktop/mycapture.jpg
3. Wait for five seconds before capturing the screen.% sleep 5; say "ready"; screencapture ~/Desktop/mycapture.png
4. Interactively (-i) select (-s) an area of your screen with the mouse.% screencapture -i -s -tjpeg ~/Desktop/mycapture.jpg
5. Interactively (-i) select a window with the mouse. When the crosshairs appear after issuing this command, press the space bar then select a window with the camera.% screencapture -i -tjpeg ~/Desktop/mywindow.jpg
6. Select an area of your screen and copy it to the clipboard (-c) rather than a file.% screencapture -i -s -c
Share
Categories
OS X's built in screencapture command provides a simple command-line utility to snap images of your desktop. It offers quite a few options...
Add a Comment
Can I capture a window with a clean shadow? I mean, only the transparent shadow itself, but NOT the background content under the shadow. This way when I post this image on a web page with any background color, the shadow always matches nicely.
May 19 2007 at 1:10 PM Report abuse Permalink rate up rate down Replyjames, justin - key commands aren't useful in scripting, and this command also allows you to select the output format.
May 17 2007 at 10:37 PM Report abuse Permalink rate up rate down ReplyHmm, the png it created couldn't be opened by Preview or Photoshop, and it didn't like the -tjpeg option. Maybe a Jaguar thing? (Yes, I'm still using Jaguar...)
It's odd, I've been having trouble getting a screen capture lately using everything from Grab to Snap 'n Drag - everything comes out garbled and there are often features mashed in like parts of windows that aren't even open. I was kind of hoping this would be an alternative that would work, but alas no.
ditto on the keyboard shortcuts, why even bother with anything else...you can't really simplify it much more.
May 17 2007 at 2:13 PM Report abuse Permalink rate up rate down ReplyI use a very useful widget called Screenshot Plus. It's great.
May 17 2007 at 1:08 PM Report abuse Permalink rate up rate down ReplyYou can do the same thing using keyboard shortcuts.
Cmd + Shift + 3 = Take screenshot of whole screen
Cmd + Shift + 4 = Draw an area to capture
Cmd + Shift + 4, then space = Capture a window.
Tim: The command line better lends itself to automation.
May 17 2007 at 11:48 AM Report abuse Permalink rate up rate down ReplyWhy not just use "Grab?" It's already designed to do this and there are no command lines necessary. I've never understood why people want to do things the more complicated/nerdy way.
May 17 2007 at 11:40 AM Report abuse Permalink rate up rate down ReplyUsed option #5 to set up the screen and SnapzPro to shoot the screen shot shooting.
May 17 2007 at 11:21 AM Report abuse Permalink rate up rate down ReplySo how did you capture THAT screen shot?
May 17 2007 at 11:20 AM Report abuse Permalink rate up rate down ReplyHot Apps on TUAW
Deals of the Day
more deals- miFrame Picture Frame Dock for iPad for $64 + $8 s&h
- Refurb Apple iPod nano 8GB MP3 Player for $99 + free shipping, 16GB for $119
- Bling Diamond Snap-On Shell Case for iPhone 4 / 4S for $2 + $2 s&h
- Hannspree Apple-Shaped 28" 1080p LCD HDTV for $270 + free shipping
- Bracketron Stand with Headrest Mount for iPad 2 for $11 + free shipping
- Philips wOOx Alarm Clock Radio for Apple iPod / iPhone for $60 + free shipping
Software Updates
more updates- EFI Firmware Update brings Lion Internet Recovery to 2010-model Macs
- OS X Lion 10.7.3 released with Safari 5.1.3, Wi-Fi bug fix
- Aperture updated to 3.2.2, addresses Photo Stream issue
- Apple updates Keynote to address Lion issues
- Google Search app gets new look on iPad
- Apple releases Apple TV Software Update 4.4.3



10 Comments