How to take multiple screenshots with scrot and
ImageMagick import commands in terminal on GNU / Linux and
FreeBSD
scrot and
import are two commands, which can be used
to take screenshot in terminal on Linux and FreeBSD:
To use
scrot cmd to take screenshots on Ubuntu and Debian
the
scrot package has to be installed:
noah:~# apt-get install scrot
...
scrot should also be available on most other Linux
distributions in the main repositories, I'll be glad to hear if
someone has used it on Fedora, SUSE etc.
On FreeBSD, there is a port called
scrot , to install on
FreeBSD:
freebsd# cd /usr/ports/graphics/scrot
freebsd# make install clean
...
Scrot has plenty of nice arguments one can use to make a
screenshot. Maybe the most handy one in my view is after a
preliminary set delay before screenshot is taken.
To take screenshot with it after lets say 5 seconds delay before
the screenshot:
hipo@noah:~/Desktop$ scrot -t 20 -d 5
To put an year, month and day and year followed by screen
resolution with
scrot :
hipo@noah:~$ scrot '%Y-%m-%d_$wx$h.png'
Another way to take a screenshot of screen with command is by using
ImageMagick's -
import image manipulation
package.
To take screenshot of the current screen via terminal using
import , type in
xterm,
gnome-termina or
Gnome's
Run Application (ALT+F2)
hipo@noah:~$ import -window root
ScreenShot.png
To make
import command to save the taken screenshot in a
format
(minute:hour:day:month:year)i :
hipo@noah:~$ import -window root
$screenshot_dir/screenshot-$(date +%M_%k_%d_%m_%Y|sed -e 's/^
*//').png
Taking a delayed screenshot is also possible via
The GIMP
via menus
File -> Create -> Screenshot
Now here is an interesting question, what if I would like to take
periodic screenshots of what I do on my Desktop to take random
movie scenes from a movie I watch with totem or vlc??
This task is quite easily achiavable with a little bash shell
script, I wrote:
screenshot_dir='Screenshots';
seconds='60';
if [ ! -d "$screenshot_dir" ]; then
mkdir $screenshot_dir;
fi
while [ 1 ]; do
sleep $seconds;
(import -window root $screenshot_dir/screenshot-$(date
+%M_%k_%d_%m_%Y|sed -e 's/^ *//').png) &
done
This script will take screenshot automatically to
Screenshots/ directory every
(1 min - 60
seconds)
You can also
my downloads take_screenshot_every_60_secs_import.sh here
To use
take_screenshot_every_60_secs_import.sh just issue
the script inside
xterm or
gnome-terminal, after that
simply use your computer as you normally would.
The script will take snapshots every minute and store all taken
screenshots in
Screenshots dir.
If you prefer to use
scrot to take automatically the
screenshots every lets say 5 minutes, you can use a script
like:
screenshot_dir='Screenshots';
# 300 secs (5 mins) seconds='300';
if [ ! -d "$screenshot_dir" ]; then
mkdir $screenshot_dir;
fi
while [ 1 ]; do
sleep $seconds;
(scrot $screenshot_dir/'%Y-%m-%d_$wx$h.png') &
done
You can
fetch take_screenshot_every_60_secs_scrot.sh here
The script using
scrot is better in terms of efficiency, the
system load scrot will put on your machine will be less.
Using some of this scripts will be handy if you need screenshots to
Movies, Programs and
favourite Free Software games.
Hope this is educative to someone ;)