Linux For Cynics One user's experiences with Linux

22Mar/130

Create Screenshots from Terminal Emulator

Probably the simplest way to create screenshots is using the commands

xwd

which dumps an image of an X window and

convert

which is a member of the ImageMagick suite of tools. It can be used for much more than converting image formats, but that's what we'll be using it for this time.

Screenshot of Whole Screen

So, to take a screenshot of your whole screen and call it capture.png, run this:

$ xwd -root | convert - capture.png

Add a Delay

Let's say you want to add a delay before the screenshot is taken (say, to move the terminal window out of the way), then simply add a sleep command before the others. For example:

$ sleep 3; xwd -root | convert - capture.png

adds a three second delay before the x window is dumped, and converted to a png.

Screenshot of Single Window

The "-root" argument to xwd tells it to capture the entire X window tree, the whole screen. If you leave it off, you will be given a cursor to click the window you want to capture.

So, if you just want to take a screenshot of a single window, then just run:

$ xwd | convert - capture.png

And click on the window you want.

Note:
I say "terminal emulator" because the xwd command relies on X to be running. This would not work on a login without X running.

Comments (0) Trackbacks (0)

No comments yet.


Leave a comment


No trackbacks yet.