HOWTO: Take a screenshot or application shot.

If you are new to YDL and have some more or less basic questions.

HOWTO: Take a screenshot or application shot.

Postby CronoCloud » 04 Aug 2008, 10:45

Some desktop environments have tools to do so, but minimalistic ones often don't.

First off you may use xwininfo to get information on your application window. You run it in a terminal and then choose the window you want info on. The most important information it provides is the Window id:

Code: Select all
[CronoCloud@mideel ~]$ xwininfo

xwininfo: Please select the window about which you
          would like information by clicking the
          mouse in that window.

xwininfo: Window id: 0x8002f6 "Yellow Dog Linux • Post a new topic - Mozilla Firefox"

  Absolute upper-left X:  0
  Absolute upper-left Y:  14
  Relative upper-left X:  0
  Relative upper-left Y:  15
  Width: 1280
  Height: 751
  Depth: 24
  Visual Class: TrueColor
  Border width: 0
  Class: InputOutput
  Colormap: 0x20 (installed)
  Bit Gravity State: NorthWestGravity
  Window Gravity State: NorthWestGravity
  Backing Store State: NotUseful
  Save Under State: no
  Map State: IsViewable
  Override Redirect State: no
  Corners:  +0+14  -0+14  -0-3  +0-3
  -geometry 1280x751+-1+-2


Once you have the window id you can use import from the Imagemagick suite to take the screenshot:

import -window window_id screenshot.jpg

If you want the window decorations you would add -frame to that.

import -window window_id -frame screenshot.jpg (or screenshot.png)

That will capture the shot immediately, but what if you wanted to wait until you had a specific menu or file open? Then you could put a simple sleep command in front to give you time to do that before the screenshot is taken:

sleep number_of_seconds_to_wait; import -window window_id -frame screenshot.jpg

For example if I wanted to capter a shot of the Firefox 3 window after 10 seconds I would do this:

sleep 10; import -window 0x8002f6 -frame screenshot.jpg

Ron Rogers Jr (CronoCloud)
CECHE01 PS3 (MGS4 80GB Bundle) without OtherOS and with an upgraded 320GB HD
Running Fedora 23 on a Compaq Presario CQ5320F upgraded with a Phenom X4 and GT640
Vizio E221A1 22" 1080P TV with HDMI, using 1080P over HDMI
PSN ID: CronoCloudAuron
User avatar
CronoCloud
Moderator
Moderator
 
Posts: 523
Joined: 21 Oct 2006, 05:48
Location: Central Illinois, USA

Re: HOWTO: Take a screenshot or application shot.

Postby tcrroadie » 06 Aug 2008, 03:38

Even easier, you could use a command line tool called scrot. For example to create a screen capture of Firefox, just run in your terminal

Code: Select all
scrot -s -d 8 firefox.png


Then left click on your Firefox window to start the 8 second count down timer and make sure that you do not have any open windows above or below your Firefox window. In 8 seconds a screen capture of your Firefox window will be made.

EDIT by CronoCloud: Thank you tcrroadie, I had not heard of scrot before, apparently it uses the Imlib libraries. It's easily installed via
Code: Select all
 yum install scrot
User avatar
tcrroadie
ydl guru
ydl guru
 
Posts: 235
Joined: 12 May 2008, 17:44
Location: Dirt Poor Michigan, U.S.A

Re: HOWTO: Take a screenshot or application shot.

Postby billb » 07 Aug 2008, 16:10

Since this is in the Beginner forum, perhaps you should mention how to take screenshots in Gnome (just hit the Print Screen key) or e17 (use the screenshot app that can be added to the iBar) in your first post. :D
PS3 60GB [CECHA01], FW 3.15, YDL 6.2, Samsung T260HD @ 1920x1200
Powermac G4 1.25 GHz x2, 2 GB RAM, YDL 6.2
User avatar
billb
Site Admin
Site Admin
 
Posts: 5522
Joined: 24 May 2007, 20:30
Location: Eastern NC, USA


Return to Beginner

Who is online

Users browsing this forum: No registered users and 4 guests

cron