Introduction.
GIMP is very useful, but sometimes doing not well. Or you find a way to capture screenshots via CLI, but the way using xwd
command does not work.
In such a case, this article might be your friend.
Also it would be useful when you use some environment that does not have the "ScreenShot" key, such as a laptop.
This article provides you the way to capture screenshots using xwininfo
and ImageMagick.
Prerequisite.
As previous, xwininfo
and import
of ImageMagick are required.
On Debian and Ubuntu, it needs to install x11-utils and imagemagick packages. To install these, run:
sudo apt install x11-utils imagemagick
Now, we are ready to do!
Step 1. Get "Window ID" using xwininfo
.
To get "Window ID", run following command in a terminal:
xwininfo
Immediately prompts shown like following:
Select the window you want to capture by clicking a mouse. Then information of the selected window is displayed following the prompt.
The most important is the first line including "Window id: ...". So the hexadecimal is a Window ID. In the previous example, Window ID is 0x4000001!
Step 2. Capture a screenshot using import
.
To capture a screenshot of the selected window using import
command, it needs to pass "Window ID" with -window
option.
Run:
import -window 0x4000001 screenshot.jpg
Finally, the screenshot is saved in the current directory!
One more thing.
I will show you "How to capture the whole desktop" by CLI.
Passing root
keyword to -window
option:
import -window root screenshot_whole_desktop.jpg
Enjoy!
Top comments (0)