Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

Capture Window To File

DZone's Guide to

Capture Window To File

·
Free Resource
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:

Opinions expressed by DZone contributors are their own.

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

{{ parent.tldr }}

{{ parent.urlSource.name }}