Said Crispin Wellington on Thu, Apr 11, 2002 at 06:03:32PM +0800:
I use import.
import -window root filename.png
It automatically saves in the format specified in the filename
extension. png, jpg etc.
To wait before a capture go...
sleep 5; import -window root filename.png
I just mention it because knowing things on the command line will come
in useful one day. (like capturing a screen remotely).
I wrote the attached script years ago to do the same thing, but to name
the shot according to the date and time, as well as increment the
filename if a similarly-named shot exists.
------------------------------------------------------------------------
#!/bin/sh
umask 133
DATE=`date +%m%d%y@%I%M%S%p`
if [ $# -ne 1 ]; then
printf "Usage:\n screenshot delay (in seconds)\n\n"
else
if [ -f /tmp/$DATE.jpg ]; then
COUNT=`ls /tmp/$DATE*.jpg |wc -w |awk '{printf $1}'`
sleep $1
import -silent -window root /tmp/$DATE'.'$COUNT.jpg
else
sleep $1
import -silent -window root /tmp/$DATE.jpg
fi
fi