Page 1 of 1
Removing overlapping windows in screenshot
Posted: 2011-11-29T08:38:05-07:00
by runningeek11
I am trying to take a screenshot of a specific window by using the following command in Shell on Linux with ImageMagick Version: 6.7.1-0 2011-11-24 Q16
import -descend -window "window name" output.png
The problem I am running into is if the window is behind other windows then I see the overlapping windows. Is there anyway to make it where I do not see the overlapping windows?
Re: Removing overlapping windows in screenshot
Posted: 2011-11-29T08:59:18-07:00
by magick
The content of an X11 window that is behind another may not even be defined (for efficiency). Its only after it is brought to the front, does the content get refreshed with exposure events. If you need the entire content of a window, ensure the window is in the front.
Re: Removing overlapping windows in screenshot
Posted: 2011-11-30T20:46:32-07:00
by anthony
One way is to use a window manager control tool such as xwit, wmctrl, wmiface, and xdotool, to ensure the desired window is fore-most. The latter is in active development, and can do a lot more than the other older commands.
Basically, you write a script to use one of those tools to select a window (get its window ID) and bring to to the top of the window stack, then give that ID to Imagemagick to grab the window.
Other means of selecting the window is to select the 'active' or current 'focused' window.. For example, this is from my won window capture shell script... It select the 'current' window, raise it, and print its information, from which I get the windows ID.
I then capure it!
Code: Select all
id=`xwit -current -raise -print | sed 's/:.*//'`
convert x:"$id" capture-tmp-$$.png
jiggle_window -t circle -id "$id"
that last command is a separate script that moves the window in a small circle, to indicate the capture is complete.
Get it from
http://www.ict.griffith.edu.au/anthony/ ... gle_window
The rest of my "capture_window" script is to rename the captured image to the next available 'sequence number' in my capture directory (gets a listing and works it out). I tie my script to a 'hot key'.