Figure 6-1. An xmag window
6.11
6.11 Script a Screen Dump 107
6.11 Script a Screen Dump
It??™s often useful to make a screen dump (or screen shot), which is a copy of what is on
the screen. KDE, GNOME, and the Gimp all provide facilities for doing this, but
some applications require a classic tool that is distributed with X itself.
The X window dump (xwd) tool takes a snapshot of the current screen, a manually
selected window or a window designated by its numeric ID, and outputs the image
to standard output or to a file. What I find useful about xwd is that it can be used in
a shell script.
By default, xwd will present a crosshair cursor for you to manually select a window:
$ xwd >file
You can select the entire root window (the whole screen) with the -root option:
$ xwd -root >file
This works well for getting screenshots of Compiz special effects in
action.
You can also specify a particular window by ID. You can obtain the ID from the
xwininfo command:
$ xwd -id IdNumber >file
The image format used by xwd is unique. A utility named xwud (for X window undump)
is provided to display window dump files:
$ xwud
The xwd image format can also be opened by the Gimp, ImageMagick (convert and
display programs), and the NetPBM utilities (xwdtopnm).
Pages:
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185