Over a million developers have joined DZone.

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
Topics:

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}