Taking screenshots from the terminal
Taking screenshots is another common day-to-day activity for any computer user. It becomes even more important for administrators that maintain GUI applications running on computers and automate them. It is important to take screenshots when a particular event happens, to figure out what is going on in a GUI application.
Getting ready
We will be using a tool from the suite of programs called ImageMagick, which was used in the previous recipe as well. Install it using your package manager.
How to do it...
Let's get started with using the import
command from ImageMagick to take screenshots:
Take the screenshot of the whole screen:
$ import -window root screenshot.png
Manually select a region to take the screenshot:
$ import screenshot.png
Take a screenshot of a specific window:
$ import -window window_id screenshot.png
To find out
window_id
, run the commandxwininfo
and click on the window you want. Then pass thiswindow_id
to the-window
option ofimport.x
...