Skip to content
Advertisement

taking a screen shot of a specific area on the screen once every second

I would like to be able to take screen shots of a specific area on the screen once every second and have the file named MMDDYYYYHH:MM:ss is this possible using the command line and a program. I was thinking of using a script like this

for((i=0;i<1000;i++))
do
import -window root screenshot-$(date '+%d%b%y-%N').png
sleep 5m
done

But I don’t know the commands to access the program to change the area on the screen and limit the images quality when saved to a file. PS: I’m willing to use a different program if it will work. I’m using Linux Ubuntu 10.04 64bit.

Thanks

Advertisement

Answer

You could use -crop WxH+X+Y option for import command To specify the area of the screen. And -quality option for quality/compression level of the output. Something like this:

import -window root -crop 200x300+100+15 -quality 100 $(date +%Y%m%d-%H%M%S).png

Note that -quality option for .png and .jpg format has nearly opposite meanings: value of 10 for png means ‘lesser compression’ (bigger size) while value of 100 – ‘maximum compression’ (minimal size). On the other hand value of 10 for jpg means ‘lesser quality’ (lower size) while value of 100 means ‘maximum quality’ (maximal size).

Advertisement