Create an animated GIF of your screencast on Linux

Image for post
Image for post

Animated GIFs of screencasts are everywhere today. How do you go from taking a screenshot of your desktop with the “Print Screen” button and recording a video of your desktop to creating an animated GIFs of your screencast to share on the internet? It’s actually easier than you think. I’m going to tell you how to do it on a Linux machine, specifically Ubuntu, because I use an Ubuntu machine. The commands here are for Ubuntu, but they can very easily be ported to other *nix machines as well.

First, you’ll need to install a few tools: ImageMagick, MPlayer, and RecordMyDesktop. We’ll be using RecordMyDesktop to record the activities on your screen or a portion of your screen as a video file. We’ll use MPlayer to convert that video into a bunch of JPEG images. We’ll then use ImageMagick’s magic to stitch them all together into an animated GIF. Sounds pretty easy, right? Let’s get started.

We’ll start by installing the required tools. For this, open up a terminal and enter the following command:

After this, you’ll need to open RecordMyDesktop app and record your screen. You can select a portion of your screen, or a particular application, or the whole desktop, depending on your needs. Once you record and save the file, run the following command to convert the video file into a bunch of JPEG images files in the directory specified in the “outdir” option:

Then, run the following ImageMagick command to convert all the JPEG files into an animated GIF.

That’s it, your animated screencast is ready. If you want, you can optimise the GIF file using the command:

That’s all. You can now share your animated GIF with the world. As an example, the GIF attached to my tweet here was created with these commands.

Coding, machine learning, reading, sleeping, listening, potato. and

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store