2

I'm looking to accomlish exactly what Anwar Shah describes here Bash script to take screenshot and save the image - Ubuntu

with the added functionality of setting a time increment for the script to continue taking screen captures. For example, I'd like to be able to execute this script and have it take and export screen shots as jpegs every 5 seconds and continue until I kill the script.

Is there any simple solution to this?

2 Answers 2

1

Yes:

#! /bin/bash
while sleep 5
do    
    shutter -f -o 'myshot-%T.jpg' -e
done

The sleep command can take various time durations as arguments: 5s (or just 5) for 5 seconds, 129m for 129 minutes, etc.
The shutter command supports JPEG output, and the %T tells Shutter to automatically replace that part with the time of the script. (There's also %NN to tell Shutter to use a counter.)

1
  • Perfect! Thank you muru, that's exactly what I was looking for.
    – user266069
    Aug 30, 2014 at 15:17
0

In my .bashrc, I define a function, screenshot to use ImageMagik:
screenshot ()
{
import -window root ~/var/screenshot/$(tshhmmss)_screendump.png
}

and, for the timestamp,

alias tshhmmss='date +%y%b%d-%H%M%S'

Then, wrapping it in while sleep 5 ... is easy.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .