Rather than use import, you can just read the screen using x: from convert
Code: Select all
convert x:root'[100x100+50+50]' +repage -write dump1.png +delete \
x:root'[100x100+200+200]' +repage -write dump2.png +delete \
x:root'[100x100+600+50]' +repage dump3.png
This reads one image from the display, writes it then deletes it from memory, then repeats it with another image from a different area. Of course the final option is an automatic
-write, and as the command ends does not need to
be deleted.
But if you want to keep things simple you can still do it the same way just just junk the final write
Code: Select all
convert x:root'[100x100+50+50]' +repage -write dump1.png +delete \
x:root'[100x100+200+200]' +repage -write dump2.png +delete \
x:root'[100x100+600+50]' +repage -write dump3.png +delete \
null:
The [...] is actually a read modifier and is equivelent to a -crop so a single read of the root window may be better.
Code: Select all
convert x:root \
\( +clone -crop 100x100+50+50 +repage -write dump1.png +delete \) \
\( +clone -crop 100x100+200+200 +repage -write dump2.png +delete \) \
\( +clone -crop 100x100+600+50 +repage -write dump3.png +delete \) \
null:
You can also ask for a specifc window,using the X window ID (which you can get from the "xwininfo" command), or a terminal WINDOWID environment variable, you can use it.
Code: Select all
convert x:$WINDOWID this_terminal.png
I have updated the special file types for "X" in IM Examples
http://www.imagemagick.org/Usage/files/#x
With the above information (and more).
NOTE that the "display" program can even 'draw' an image into a another applications X window..
From an 'xterm' try this...
Code: Select all
window=`xwininfo -children -id $WINDOWID |\
sed -n 's/^ *\(0x[^ ]*\).*/\1/p'`; \
convert x:$window -background black \
-draw 'fill black rectangle 40,40 160,160' \
-draw 'stroke red line 50,50 50,150 line 50,150 150,150' \
-draw 'fill lime circle 110,100 80,100' \
-draw 'stroke dodgerblue line 50,150 150,50' \
png:- |\
display -window $window -
The funny bit at the top is because the window to draw into must be the 'child' window of the one given as $WINDOWID. For a Gnome-Terminal, you can just directly assign "window=$WINDOWID".
NOTE the XTERM application does not know of the changes you made to its window. How could it! As such if the window is re-drawn for some reason (remove an obscuring window, change desktop, iconize/de-iconize, scrolls off then on again) then the xterm application will redraw what it things should be present, so destroying the effect.
That is it is temporary!
Now imagine what you can do with this!!!!