Scrot easy snapshots with the CLI.

What do you have and what do you want?

Moderators: b1o, jkerr82508

User avatar
viking60
Über-Berserk
Posts: 9301
Joined: 14 Mar 2010, 16:34

Scrot easy snapshots with the CLI.

Postby viking60 » 24 Jun 2014, 22:05

I have discovered Scrot and it really has made it easier to take screenshots of my system.
Scrot is in most repos I have found it in Manjaro Mageia and OpenMandriva so far.

All you have to do is:

Code: Select all

scrot

This will create a date and time stamp pic.

If you want to name it and decide the format you can do so:

Code: Select all

scrot desktop.png

And the snapshot of your desktop is saved on your computer under the name desktop.png you can also call it Desktop.png or something else.

How is this easier than simply pressing Prnt scr you say? Eh well it isn't - it is pretty much the same.
So how about this:
What if I want to make a screenschot of my desktop and thumbnail of it at the same time?
That is no problem:

Code: Select all

scrot  -t 10 desktop.png

by adding - t (for thumbnail) and 10 for 10 % of the original picture; the magic happens.
desktop.png and desktop-thumb.png are created.

Now that is a bit harder with regular print screen. But since this is a terminal program; how fancy do all your snapshots look when the terminal is always in it?
Not very cool I am afraid :snooty:
We can fix that too with a delay, by using the -d switch like this:

Code: Select all

scrot -d 3 desktop.png

This will give you a delay of 3 seconds to hide the terminal - there are no prizes for guessing what to do if you need 10 seconds :-D

If you want the thumb too; your command would be:

Code: Select all

scrot -t 10 -d 3 desktop.png


The pictures will be saved in the location you are standing. If you like you can put a path in the command.

Code: Select all

scrot -t 10 -d 3  ~/Pictures/scrot/desktop.png

This will save your snapshots in ~/Pictures/scrot.

Scrot takes snapshot with 75 % quality. If you want that superduper pic with 100 % quality you can do so with the -q switch

Code: Select all

scrot -q 100 -t 10 -d 3  ~/Pictures/scrot/desktop.png

Again: there are no prizes for guessing what to do if you want 90 % quality :-D

But wait that is not all.....
:drummer
.....
:drummer
:S Scrot can also take screenshots of areas of your desktop +1

All you have to do is using the -s switch

Code: Select all

scrot -s desktop.png

Now scrot will wait for you to mark the area you want to take a screenshot of, with your mouse, and take the shot as soon as you are finished marking.

It works well, but it is kind of a silent operation so I needed to look at the directory in Thunar to make sure that the snapshot was actually taken.
To make Scrot tell us what happens we can add the - c switch. It is a countdown for the delay that also adds some additional info like "done".

So this command never leaves any doubt:

Code: Select all

scrot -s -d 3 -c desktop.png

The output will be something like this:

Code: Select all

Taking shot in 3.. 2.. 1.. 0.

So this is a nice little wizard that takes care of screenshots; try this one to make a snapshot of an area:
:A

Code: Select all

echo "select the area you want to take a screenshot of" & scrot -q 100 -s -d 3 -c  Berserkpic.jpg

If you like it save it as an alias and put a path in there so your snapshots always are saved in the same place - something like this:

Code: Select all

alias ashot= 'echo "select the area you want to take a screenshot of" & scrot -q 100 -s -d 3 -c  ~/Pictures/scrot/Berserkpic.jpg'

Here is the result of my ashot command where I selected a bit of the screen - The pic is full size.
Image

Here is a pic of my dropdown terminal, to show that you can also select areas within a terminal:
Image
Image

Or even within a VirtualBox client.

Great stuff, I tell you +1
Manjaro 64bit on the main box -Intel(R) Core(TM) i7 CPU 920 @ 2.67GHz and nVidia Corporation GT200b [GeForce GTX 275] (rev a1. + Centos on the server - Arch on the laptop.
"There are no stupid questions - Only stupid answers!"

User avatar
viking60
Über-Berserk
Posts: 9301
Joined: 14 Mar 2010, 16:34

Re: Scrot easy snapshots with the CLI.

Postby viking60 » 25 Jun 2014, 11:12

You do not have to select an area with mouse when using the -s switch; You can simply pick an entire window by clicking on it (without holding in the left mouse key and draging).
Here I picked the Terminal window:
Image

And here is my Scrot directory shown in the Thunar window:
Image

All you have to do is a;

Code: Select all

scrot -s
and click on a window.
Or simply hit ALT+F2 and type scrot -s

Scrot is ideal for low spec machines.
You can check how it compares to imagemagic here:
:A
viewtopic.php?f=25&t=2598&start=12#p18702
Manjaro 64bit on the main box -Intel(R) Core(TM) i7 CPU 920 @ 2.67GHz and nVidia Corporation GT200b [GeForce GTX 275] (rev a1. + Centos on the server - Arch on the laptop.
"There are no stupid questions - Only stupid answers!"


Return to “Software”