[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
Next revisionBoth sides next revision
howtos:window_managers:take_a_screenshot [2013/02/09 16:53 (UTC)] – [How To Take a Screenshot ?] hazelhowtos:window_managers:take_a_screenshot [2013/02/09 17:15 (UTC)] – [To go further] hazel
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 only chose one as an example, called ''xpaint''.+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.
  
-But it doesn'work 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'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.
  
 ===== Using the Import Function of an Application ===== ===== Using the Import Function of an Application =====
-I will explain here how to do it with ''xpaint'', a pretty light software that has the basic tools you would need to work on a screenshot. You may not need all the power of The GIMP to do some basic changes to a screenshot. Plus it's already installed in a default Slackware install.+I will explain here how to do it with ''xpaint'', a pretty lightweight piece of software that has the basic tools you would need to work on a screenshot. You do not need all the power of The GIMP to make some basic changes to a screenshot. Plus it's already included in a default Slackware install.
  
-Open ''xpaint'' from an xterm, or from your DE / WM menu. Open the "Canvas" menu and select "Take snapshot". A little edge appears, this will allow you to select the application window you are capturing. Then, it depends which mouse button you click on.+Open ''xpaint'' from an xterm, or from your DE / WM menu. Open the "Canvas" menu and select "Take snapshot". A little edge appears, which will allow you to select the application window you are capturing. What happens next depends which mouse button you click on.
   * To capture the whole screen, left-click or middle-click somewhere on your desktop. To be precise, on a part of the desktop where you can see the desktop's background or background image.   * To capture the whole screen, left-click or middle-click somewhere on your desktop. To be precise, on a part of the desktop where you can see the desktop's background or background image.
   * To capture a specific window, left-click or middle-click somewhere in it.   * To capture a specific window, left-click or middle-click somewhere in it.
Line 21: Line 21:
 ===== The Keyboard Method ===== ===== The Keyboard Method =====
 Press the <key>PrtScr</key> key, located usually on the top-right of your keyboard. It can also read <key>PrnScr</key>, <key>Print Screen</key>, etc. Open an image editing program (GIMP, xpaint, ...), and choose the paste option, usually the <key>Ctrl+V</key> combo. On some systems, it has been reported that using <key>Alt+PrtScr</key> solves the problem. Press the <key>PrtScr</key> key, located usually on the top-right of your keyboard. It can also read <key>PrnScr</key>, <key>Print Screen</key>, etc. Open an image editing program (GIMP, xpaint, ...), and choose the paste option, usually the <key>Ctrl+V</key> combo. On some systems, it has been reported that using <key>Alt+PrtScr</key> solves the problem.
-<note>Neither of the methods are working on my system, and as I don't know yet if it's because of my hardware/laptop configuration or because of my X keyboard setup, I can't guarantee that it will work on your system. Neither can I tell you if it's supposed to work on a tty. The article will eventually show the hint as I find out or someone else posts some suggestion(s).\\ </note>+<note>Neither of these methods works on my systemI don't know yet if it's because of my hardware/laptop configuration or because of my X keyboard setup, so I can't guarantee that it will work on your system. Neither can I tell you if it's supposed to work on a tty. The article will eventually show the hint as I find out or someone else posts some suggestion(s).\\ </note>
  
 ===== The Command-Line Way ===== ===== The Command-Line Way =====
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, 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 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 ()