Sunday, December 14, 2008

Screenshots from the command line

Use the screencapture utility to initiate a screenshot from the command line.

Take a screenshot and save the result to a file

This command can be used to take a screenshot with a 10 second delay (-T 10) and save the result in jpg format (-t jpg) to a file named screen.jpg:

screencapture -T 10 -t jpg screen.jpg

If the file format is not specified, a png file is saved. The time delay lets you change desktops if you are using Spaces (the multiple desktop feature in Leopard) before the screenshot is taken.