LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices

Reply
 
Search this Thread
Old 12-02-2005, 08:38 AM   #1
Hko
Senior Member
 
Registered: Aug 2002
Location: Groningen, The Netherlands
Distribution: ubuntu
Posts: 2,530

Rep: Reputation: 108Reputation: 108
Command line screenshot of a single window


Hi,

I'm trying to make a screenshot of a single window from a (bash) script. The "import" utility from ImageMagick has a -window option to specify a window-ID or window-name to grab it non-interactively. But it doesn't seem to work. Google gave me only man-pages with information I already got, and web-pages that only mention "import -window root" to take a shot of the entire screen, which does work, but is not what I'm looking for.

I get the window ID from "xprop", or "xlsclients -l". Example:
Code:
bash$ xlsclients -l
Window 0x1a00001:
  Machine:  hko3
  Name:  firefox-bin
  Icon Name:  firefox-bin
  Command:  firefox-bin
  Instance/Class:  firefox-bin/Firefox-bin
So I try:
Code:
bash:/tmp$ import -window 0x1a00001 test.jpg
import: UnableToReadXWindowImage (0x1a00001).
import: missing an image filename `test.jpg'.
I also think the second error message is a bit strange: it tells me it's missing a filename, and also mentions the file name?! Am I doing something wrong here?

The window ID seems OK though:
Code:
bash$ xprop -id 0x1a00001
WM_CLASS(STRING) = "firefox-bin", "Firefox-bin"
[...]
I also tried window-names instead of ID's:
Code:
import -window firefox test.jpg
import: NoWindowWithSpecifiedIDExists (firefox).
#...it then waits for me to select a window with the mouse, so I suppose the name is incorrect:

import -window firefox-bin test.jpg
import: UnableToReadXWindowImage (firefox-bin).
import: missing an image filename `test.jpg'.
# The name now seem OK, but no screenshot..
A similar problem happens when I try "xwd", the screenshot utility from xfree86 itself:
Code:
bash:/tmp$ xwd -id 0x1a00001 -out test.img
X Error of failed request:  BadMatch (invalid parameter attributes)
  Major opcode of failed request:  73 (X_GetImage)
  Serial number of failed request:  434
  Current serial number in output stream:  434
Making screenshots of a single window with The Gimp works perfectly.

Does anybody have an idea what's wrong?
Thanks in advance for any ideas.

PS. I'm running Debian sarge, which has:
ImageMagick version: 6.0.6 05/26/05
 
Old 12-02-2005, 09:21 AM   #2
Hko
Senior Member
 
Registered: Aug 2002
Location: Groningen, The Netherlands
Distribution: ubuntu
Posts: 2,530

Original Poster
Rep: Reputation: 108Reputation: 108
Update information

I found out that the problem exist only with certain applications like XFCE4-panel and firefox. I can capture xterms, and some other programs witout problems.

Anybody knows how to get a screenshot of firefox non-interactively?
 
Old 11-09-2010, 08:01 PM   #3
danny0085
Member
 
Registered: Apr 2008
Posts: 37

Rep: Reputation: 1
Shutter

Try shutter it the best screenshot software I ever seen

http://tips-linux.net/en/content/shutter
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Is there a single command to list all hardware installed (command line)? davee Linux - Hardware 6 02-28-2009 07:19 PM
Retrieve Window ID in command line.. joely2k Linux - General 3 11-26-2005 11:44 AM
Command line to raise a window? joely2k Linux - General 2 11-25-2005 12:42 PM
How do you start X-window from command line? yekrahs Suse/Novell 2 11-18-2005 09:12 AM
How switch from x-window to the command line backpacker Linux - Newbie 1 06-09-2005 03:56 AM


All times are GMT -5. The time now is 04:37 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration