[2024-feb-29] Sad news: Eric Layton aka Nocturnal Slacker aka vtel57 passed away on Feb 26th, shortly after hospitalization. He was one of our Wiki's most prominent admins. He will be missed.

Welcome to the Slackware Documentation Project

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
Last revisionBoth sides next revision
howtos:window_managers:take_a_screenshot [2013/02/09 17:01 (UTC)] – [The Keyboard Method] hazelhowtos:window_managers:take_a_screenshot [2016/02/03 23:05 (UTC)] – ADDED: KSnapshot arfon
Line 4: Line 4:
  
 Taking a screenshot can be done in several ways.\\  Taking a screenshot can be done in several ways.\\ 
-The easiest is to use a graphics program (for example The GIMP or xpaint) and choose the built-in screenshot or snapshot menu option. The method may be very different from one application to another, so I have chosen ''xpaint'' as an example.+The easiest is to use a graphics program (for example KSnapshot, The GIMPor xpaint) and choose the built-in screenshot or snapshot menu option. The method may be very different from one application to another, so I have chosen ''xpaint'' as an example.
  
 But you can't use this program to make a screenshot of a video or an image in full-screen, for example. To circumvent this, you can use the <key>PrtScr</key> key (aka Print Screen), or use some command-line tools designed for the X window system. I'll quickly describe the basic switches of an X tool called ''xwd'', and Imagemagick's ''import'' command. But you can't use this program to make a screenshot of a video or an image in full-screen, for example. To circumvent this, you can use the <key>PrtScr</key> key (aka Print Screen), or use some command-line tools designed for the X window system. I'll quickly describe the basic switches of an X tool called ''xwd'', and Imagemagick's ''import'' command.
Line 34: Line 34:
 <code>xwd | convert - path/to/screenshot.ext</code> <code>xwd | convert - path/to/screenshot.ext</code>
  
-You will be provided with a crosshair, just select the window you want to capture. You can change the type of the output file only by changing the extension, for example ''screenshot.png'', ''screenshot.jpg'', ''screenshot.gif'', etc. The ''-'' switch is to indicate ''convert'' that you are using the standart input. +You will be provided with a crosshair tool; use it to select the window you want to capture. You can change the type of the output file only by changing the extension, for example ''screenshot.png'', ''screenshot.jpg'', ''screenshot.gif'', etc. The ''-'' switch is to indicate to ''convert'' that it should translate from standard input rather than a file
-<note tip>Remember to bring the window you want to grab on top of the others. Every window which covers it will be replaced by black pixels (or black boxes) in the final capture. Which by the way can be an useful way to hide some parts of the output! For example if you take a screenshot of an xterm full of commands with some of your personal info displayed (passwords, IP addresses, ...), or a screenshot of a browser and you want to hide some tabs. Just place some windows over the one you want to capture.</note>+<note tip>Remember to raise the window you want to grab above the others. Otherwise every window which covers it will be replaced by black pixels (or black boxes) in the final capture. Which by the way can be an useful way to hide some parts of the output! For example if you take a screenshot of an xterm full of commands with some of your personal info displayed (passwords, IP addresses, ...), or a screenshot of a browser and you want to hide some tabs. Just place some windows over the one you want to capture.</note>
  
 If you want to capture a window WITH its overlayered windows, so that the capture does not display a black box but instead the overlaying window(s) content (for example, an application menu or an xterm window over a browser to capture both at the same time, etc), use the ''-screen'' switch: If you want to capture a window WITH its overlayered windows, so that the capture does not display a black box but instead the overlaying window(s) content (for example, an application menu or an xterm window over a browser to capture both at the same time, etc), use the ''-screen'' switch:
Line 43: Line 43:
 Add the ''-root'' switch to get: Add the ''-root'' switch to get:
 <code>''xwd -root | convert - path/to/screenshot.ext''</code> <code>''xwd -root | convert - path/to/screenshot.ext''</code>
-The ''-root'' indicates you want to grab the "main" X window, so all what you can see currently displayed on screen (//root// is the name of the main X window). As it's capturing the whole screen, you wont need to select a window.\\ +The ''-root'' indicates you want to grab the "main" X window, so all what you can see currently displayed on screen (//root// is the name of the main X window). As it's capturing the whole screen, you won'need to select a window.\\ 
  
 ==== Imagemagick's ''import'' Command ==== ==== Imagemagick's ''import'' Command ====
  
-<note warning>There may be a bug or at least a glitch on some systems, as ''import -screen'' and ''import -window root'' may show "black boxes" overlaying the window that has been captured, which indicates that some other window(s) are getting on top of it before the capture takes place, even if you don't see it(them)!\\  +<note warning>There may be a bug or at least a glitch on some systems, as ''import -screen'' and ''import -window root'' may show "black boxes" overlaying the window that has been captured, which indicates that some other window(s) are getting on top of it before the capture takes place, even if you don't see it/them!\\  
-I don't know what causes this behaviour, nor have found or really searched for an explanation yet. Nonetheless, it seems that the ''-frame'' switch works better, but it has the same limitations as ''-screen'' (you can't get overlaying windows content). You can also try to minimize all open windows.\\ If it doesn't help, use ''xwd'' for correct captures, or grab your hitchhiking guide and get on google.</note>+I don't know what causes this behaviour, nor have found or really searched for an explanation yet. Nonetheless, it seems that the ''-frame'' switch works better, but it has the same limitations as ''-screen'' (you can't get overlaying windows content). You can also try to minimize all open windows.\\ If that doesn't help, use ''xwd'' for correct captures, or grab your hitchhiking guide and get on google.</note>
  
-The ''import'' command is part of the ImageMagick suite of tools. It works as ''xwd'' but doesn't need the ''convert'' program and use different options (switches).+The ''import'' command is part of the ImageMagick suite of tools. It works like ''xwd'' but doesn't need the ''convert'' program and uses different options (switches).
  
 === Capturing a window === === Capturing a window ===
Line 65: Line 65:
 or or
 import -frame path/to/screenshot.ext</code> import -frame path/to/screenshot.ext</code>
-The ''-window root'' is equivalent to ''xwd'''s ''-root'' switch. It captures the whole desktop. The ''-frame'' option can be used to prevent black boxes as per the warning.+The ''-window root'' is equivalent to ''xwd'''s ''-root'' switch. It captures the whole desktop. The ''-frame'' option can be used to prevent black boxes as in the warning above.
  
 ==== Hints for Fullscreen Applications ==== ==== Hints for Fullscreen Applications ====
Line 73: Line 73:
   * In the player/viewer, play the video or show the image   * In the player/viewer, play the video or show the image
   * Choose the fullscreen view mode.   * Choose the fullscreen view mode.
-  * Wait for the crosshair to display, then click. Your screenshot is now recorded.+  * Wait for the crosshairs to display, then click. Your screenshot is now recorded.
  
-You can use whatever command switches or even noneit's up to you. Without switches you'll have to click the window to capture, with any of them the screenshot will be taken just after the ''sleep'' countdown reaches 0.\\ +You can use whatever command switches you like or even none it's up to you. Without switches you'll have to click the window to capture, with any of them the screenshot will be taken just after the ''sleep'' countdown reaches 0.\\ 
 If you are using the automated methods (ie. ''xwd -root'' or ''import -window root''), you can add a bell after the command, so you know the operation is complete. The full command is then: If you are using the automated methods (ie. ''xwd -root'' or ''import -window root''), you can add a bell after the command, so you know the operation is complete. The full command is then:
 <code>sleep 15 ; xwd -root | convert - path/to/screenshot.ext ; echo $'\a'</code> <code>sleep 15 ; xwd -root | convert - path/to/screenshot.ext ; echo $'\a'</code>
Line 82: Line 82:
  
 ====== To go further ====== ====== To go further ======
-The tools are well documented in their ''man'' pages, I recommend you reading them for fine tuning or better automation of your screenshots: ''man import'', ''man xwd'', ''man convert''.\\  +The tools are well documented in their ''man'' pages, I recommend you to read them for fine tuning or better automation of your screenshots: ''man import'', ''man xwd'', ''man convert''.\\  
-''xwd'' has a respective program called ''xuwd''. It reads an ''xwd'' dump (either from dump file or standart input) and displays it. It can be useful for automatic display of screenshots done on remote machines, if you don't need to save the files.+''xwd'' has a corresponding program called ''xuwd''. It reads an ''xwd'' dump (either from dump file or from standard input) and displays it. It can be useful for automatic display of screenshots taken on remote machines, if you don't need to save the files.
  
 ====== I do not want to read all this article! I'm in a hurry! ====== ====== I do not want to read all this article! I'm in a hurry! ======
 howtos:window_managers:take_a_screenshot ()