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.
import of ImageMagick are required.
sudo apt install x11-utils imagemagick
Now, we are ready to do!
To get "Window ID", run following command in a terminal:
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!
To capture a screenshot of the selected window using
import command, it needs to pass "Window ID" with
import -window 0x4000001 screenshot.jpg
Finally, the screenshot is saved in the current directory!
I will show you "How to capture the whole desktop" by CLI.
root keyword to
import -window root screenshot_whole_desktop.jpg