Jul 28

Scrot - A command line screen capture utility

Scribbled on Monday, July 28th, 2008

Updated on: 31 July, 2008 at 4:06 PM IST

Scrot is used to take screenshots of your desktop. Few things that you can do are:

Install it:

sudo apt-get install scrot

(Debian or Ubuntu users)

Features and Usage:

pacman -S scrot

(Arch Linux users, be sure to su before this command)

  • Whole desktop screenshot
scrot
  • Select a region on desktop
scrot -s

Select the region

  • Select a window on desktop without border
scrot -s

Click on a window to capture borderless window

  • Option to includewindow border
scrot -sb

Click on a window to capture with border

  • A delay of time after which the screenshot will be taken, comes handy when you want to capture drop down menu or context menu
scrot -d 3

Here a delay of three second is applied before capturing the desktop, best when you want to capture a context menu like this:

capture application menu or context menu !

capture application menu or context menu !

Remember you can use delay with all actions, e.g.

scrot -d 3 -sb

But you know, its stupid here to do this :p

  • You can use a count to display before taking screeshot
scrot -d 3 -c

This will display a count before taking screenshot, as shown in pic below

display a count before capturing

display a count before capturing

  • Set the image quality too
scrot -q 80

It will save the image with 80% quality, of course depending on the image type (by default its png)

  • Also you can save the thumbnail too, simultaneously !
scrot -t 20

It will save a thumbnail file at 20% of the original image, like this:

easily save thumbnail too !

easily save thumbnail too !

  • Save with you own custom image name
scrot ‘%Y_%m_%d_$wx$h.png’

This would create a file called something like 2000-10-30_2560×1024.png

Few special strings you can use are:

$f image path/filename (ignored when used in the filename)
$n image name (ignored when used in the filename)
$s image size (bytes) (ignored when used in the filename)
$p image pixel size
$w image width
$h image height
$t image format
$$ prints a literal ‘$’

  • What if you want to execute another command after taking screenshot, e.g. you want to move the captured shot to the directory “shots” in your home folder or to open it in GIMP for editing.
scrot -e ‘mv $f ~/shots/’

$f is the image path of the captured image and and mv command moves the file to shots folder

TIP

Make an alias of the scrot command and save it to you .bashrc file, that way you don’t have to type long and keep the setting saved.

Mine alias is

alias sct=”scrot ‘Desktop_%Y_%m_%d_%s.jpg’ -d 4 -t 40 -q 85 -e ‘mv ‘Desktop_%Y_%m_%d_%s.jpg’ ~/shots/ && mv ‘Desktop_%Y_%m_%d_%s-thumb.jpg’ ~/shots/’”
alias scb=”scrot ‘Window_%Y_%m_%d_%s.jpg’ -sb -t 40 -q 85 -e ‘mv ‘Window_%Y_%m_%d_%s.jpg’ ~/shots/ && mv ‘Window_%Y_%m_%d_%s-thumb.jpg’ ~/shots/’”

Here is the screenshot of my desktop !

A thumbnail (yeah its a lil bit large) :p

A thumbnail (yeah its a lil bit large) :p


Enjoyed this post? Subscribe to Full Feeds or by Email and receive free daily updates on this Blog.

Related posts:

  1. Dropbox installation on Linux and a brief review ! Updated on: 14 Sep, 2008 at 2:16 PM IST Added...
  2. FFmpeg - Convert any audio/video format in Linux Converting an audio or video file from one format to...
  3. Arch Linux installation from ground up Updated on: 31 July, 2008 at 4:28 PM IST NOTE:...
  4. Convert Autocad DWG files to DXF in Ubuntu, use QCad to edit them Some weeks back my bro switched over to Ubuntu completely....
  5. Funny moments in Linux Here are some pretty funny moments captured in Linux :p...

Related posts brought to you by Yet Another Related Posts Plugin.

Post a Comment

July 2008
M T W T F S S
« Jun   Aug »
 123456
78910111213
14151617181920
21222324252627
28293031