[Kgif][2]is a simple shell script which create a Gif file from active window. I felt this app especially designed to capture the terminal activity. I personally used, very often for that purpose.
It captures activity as a series of PNG images, then combines all together to create a animated GIF. The script taking a screenshot of the active window at 0.5s intervals. If you feel, its not matching your requirement, straight away you can modify the script as per your need.
Originally it was created for capturing tty output and creating preview for github projects.
Make sure you have installed scrot and ImageMagick packages before running Kgif.
Suggested Read :[Peek – Create a Animated GIF Recorder in Linux][3]
What’s ImageMagickImageMagick is a command line tool which used for image conversion and editing. It support all kind of image formats (over 200) such as PNG, JPEG, JPEG-2000, GIF, TIFF, DPX, EXR, WebP, Postscript, PDF, and SVG.
What’s ScrotScrot stand for SCReenshOT is an open source, command line tool to capture a screen shots of your Desktop, Terminal or a Specific Window.
#### Install Dependencies
Kgif required scrot and ImageMagick to work.
For Debian based Systems
```
$ sudo apt-get install scrot imagemagick
```
For RHEL/CentOS based Systems
```
$ sudo yum install scrot ImageMagick
```
For Fedora Systems
```
$ sudo dnf install scrot ImageMagick
```
For openSUSE Systems
```
$ sudo zypper install scrot ImageMagick
```
For Arch Linux based Systems
```
$ sudo pacman -S scrot ImageMagick
```
#### Install Kgif & Usage
Installation of Kgif not a big deal because no installation required. Just clone the source file from developer github page wherever you want and run the`kgif.sh`file to capture the active window. By default, it’s sets delay to 1 sec, you can modify this by including`--delay`option with kgif. Finally press`Ctrl+c`to stop capturing.
```
$ git clone https://github.com/luminousmen/Kgif
$ cd Kgif
$ ./kgif.sh
Setting delay to 1 sec
Capturing...
^C
Stop capturing
Converting to gif...
Cleaning...
Done!
```
Check whether dependencies are presents in system.
```
$ ./kgif.sh --check
OK: found scrot
OK: found imagemagick
```
Set delay in seconds with script to start capturing, after N seconds.
```
$ ./kgif.sh --delay=5
Setting delay to 5 sec
Capturing...
^C
Stop capturing
Converting to gif...
Cleaning...
Done!
```
It save the gif file name as a`terminal.gif`and overwrite every time whenever get a new file. So, i advise you to add`--filename`option to save the file in a different name.
```
$ ./kgif.sh --delay=5 --filename=2g-test.gif
Setting delay to 5 sec
Capturing...
^C
Stop capturing
Converting to gif...
Cleaning...
Done!
```
Set noclean with script to keep the source png screen shots.