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
Capture Window To File
Extremely simple script to capture a window to a file.
#!/bin/sh
#
# Capture window image and save file
#
# Dependencies: imagemagick
#
set -e
# Main
test $# -ge 1 || { echo "Usage: capture_window FILE [SECONDS]"; exit 1; }
FILE=$1
WAIT=$2
test "$WAIT" && sleep $WAIT
import - | convert - $FILE
echo $FILE





