Saturday, May 2, 2009

Taking Screenshots in Linux

It's nice to be able to take pictures of your computer screen. Then, you can show the pictures to your friends or put it on the Web so people can be impressed with your pictures.


In Microsoft Windows, taking pictures of the computer screen is as easy as pressing the Print or Alt+Print key. Pressing the Print key takes a screenshot of the whole screen, whereas pressing the Alt+Print grabs the current focused Windows only.


However, taking screeenshots in Linux is not as simple as in Windows unless you use GNOME or KDE. In this post, I will list many ways of taking screenshots in Linux.


xwd, xwdtopnm and pnmtojpeg combination


In the most primitive way, I use a combination of xwd, xwdtopnm and pnmtojpeg. This method requires you to type commands in xterm. The following example takes the screenshot of the root window — the whole desktop:


xwd -root -screen | xwdtopnm | pnmtojpeg --quality=85 --optimize > ~/screenshot-`date +%F_%T`.jpeg

In case you want to take only the picture of the focused windows, the following example shows how:


xwd -frame -screen | xwdtopnm | pnmtojpeg --quality=85 --optimize > ~/screenshot-`date +%F_%T`.jpeg

It's useful to append a sleep command so that you have the time to select the window or arrange the screen the way you want:


sleep 5 && xwd -frame -screen | xwdtopnm | pnmtojpeg --quality=85 --optimize > ~/screenshot-`date +%F_%T`.jpeg

No comments:

Post a Comment

About This Blog

KBlog logo This blog is about current events and issues concerning general population. Thanks for visiting the blog and posting your comments.

© Contents by KBlog

© Blogger template by Emporium Digital 2008

Followers

Total Pageviews

icon
Powered By Blogger