Screen shots
The best program I've found for taking screenshots is import, which is part of the ImageMagick suite of image handling utilities.
To grab the whole screen, type:
import -window root foo.png
where foo.png is the name of the file to save the image to. The file format is determined by the filename suffix.
To save a selected window, type:
import foo.png
and then click on the desired window.
To save a selected rectangular region of the screen, type:
import foo.png
and then click and drag to specify the region.
If you want to capture a window with a drop-down menu or tooltip
visible, you will need to use a more complicated procedure. Firstly,
type:
xwininfo
and then click on the window that you want to capture. This will provide you with a "window id" for the window. Then type:
sleep 10; import -window 0x1600040 foo.png
where 0x1600040 is the window id provided by xwininfo. You now have 10 seconds in which to use the mouse to make the drop-down menu visible before the screenshot is taken.
A more convenient way to do this is to capture the window that currently has focus, using the following:
winid=$(xdpyinfo | sed -ne 's/^focus:.*\(0x[^,]\+\).*/\1/p')
import -window $winid -frame foo.png
The first line (found from a Google search) gets the window id of the focussed window. The '-frame'
option in the second line seems to be necessary for some windows to be
captured correctly. You could put a 'sleep 10'
in front of these commands and run them manually from an xterm. But to
make it more convenient, I've put the commands in a shell script and
arranged for it to be called when I press the SysRq/PrtSc key - see
notes on xbindkeys
for how to do this (PrtSc has keycode 111). I've also arranged for the Alt-PrtSc key to dump the whole screen.
There are lots of options for import (see the documentation or type 'import -help' for details), but the most useful are probably the following:
Option |
Description |
-help |
Print descriptions of options. |
-window id |
Dump the window with identifier id. |
-window root |
Dump whole screen instead of selected window. |
-frame |
Include window frame in image. |