Take a screenshot of the window the user clicks on and name the file the same as the window title
Take a screenshot of the window the user clicks on and name the file the same as the window title
1
|
In general, this is actually not better than the “scrot -d4” command I’m listing it as an alternative to, so please don’t vote it down for that. I’m adding this command because xwd (X window dumper) comes with X11, so it is already installed on your machine, whereas scrot probably is not. I’ve found xwd handy on boxen that I don’t want to (or am not allowed to) install packages on.
NOTE: The dd junk for renaming the file is completely optional. I just did that for fun and because it’s interesting that xwd embeds the window title in its metadata. I probably should have just parsed the output from file(1) instead of cutting it out with dd(1), but this was more fun and less error prone.
NOTE2: Many programs don’t know what to do with an xwd format image file. You can convert it to something normal using NetPBM‘s xwdtopnm(1) or ImageMagick‘s convert(1). For example, this would work: “xwd | convert fd:0 foo.jpg”. Of course, if you have ImageMagick already installed, you’d probably use import(1) instead of xwd.
NOTE3: Xwd files can be viewed using the X Window UnDumper: “xwud
NOTE4: The sleep is not strictly necessary, I put it in there so that one has time to raise the window above any others before clicking on it.
* View this command to comment, vote or add to favourites * View all commands by hackerb9
commandlinefu.com
by David Winterbottom (codeinthehole.com)
URL: http://feedproxy.google.com/~r/Command-line-fu/~3/RK7WEj8ydPg/take-a-screenshot-of-the-window-the-user-clicks-on-and-name-the-file-the-same-as-the-window-title
Related articles
- Magick++ — C++ API for ImageMagick (imagemagick.org)
- Animate .gif images in R / ImageMagick (r-bloggers.com)
- RMagick (rmagick.rubyforge.org)
- Duane Hinnen: Help add screenshots to the Software Center (okiebuntu.homelinux.com)
Related Articles:
- 2010/11/11 function for copy files with progress bar (using pv – pipe viewer)
- 2010/11/02 Photo Editing with nice border and preparing for print.
- 2010/09/12 Using EOG and other image viewers to learn tricks of photography
- 2010/12/17 Repeat a portrait eight times so it can be cut out from a 6″x4″ photo and used for visa or passport photos
- 2010/12/05 New feature in Gnome/Nautilus
Authored By Amit Agarwal
Amit Agarwal, Linux and Photography are my hobbies.Creative Commons Attribution 4.0 International License.