简体   繁体   中英

Make screenshot of window in focus without window`s decorations

I have to make an screenshot of active window's content (without window's decorations). I decided to use imagemagick and I know how to make screenshot of whole screen, but it i'snt what I need.

It also possible to use other programs, I appreciate imagemagick because it will be used in this script anyway.

Thank you for responding!

import , the screen-shooting tool that comes with ImageMagick, takes a -window flag that lets you choose the window you want to capture, either by its ID or name. It doesn't capture the window border by default. (If you change your mind and decide that you do want to include it, also pass the -frame flag.)

You can then use xdotool to find out the ID of the currently focused window, like so:

import -window "$(xdotool getwindowfocus -f)" /tmp/file.png

Source

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM