[Linux] X-server ScreenShots from the CLI "ImageMagick"

Build some documentation for a customer and required some screenshots, KDE has Ksnaphot. But I wanted many screen shots and need a simple cli command to capture various screens.

ImageMagik provides the "import" command which does just the job from the command line.

To capture the whole desktop as a JPEG use the following.
$ import -window root screen.jpg

To save in a diffrent grapics format change the extention of the output file. (gif,pnm,pmm,tiff etc..)

To capture single window ie firefox
You need to find the window name, two methods of getting the "window name"
1. use xwininfo, which will then ask you to click target window and display information.

2. xlsclients -l
display list of windows

Note you can use a window title or the DECIMAL window ID, xwininfo and xlsclients output in HEX.

$ import -window <WINDOW ID DECIMAL> screen1.jpg
$ import -window "<WINDOWS TITLE>" screen2.jpg


Popular posts from this blog

Solaris 11 Locale en_GB.UTF-8 / en_GB.ISO8859-1 / en_GB.ISO8859-15

SMcli Examples

ZFS Compression Vs Deduplication (dedup)