Create a Screenshot or Screencast in GIF

This article is a contribution made in our forum by the user Wada

I have the idea of ​​making a post about Vim and its functions that I think many are unaware of and to make it more striking I said to myself: maybe I could create some gifs ... so I got down to work and well, I also share how it works big_smile

First install the necessary applications:

# pacman -S recordmydesktop mplayer imagemagick

Capture with recordmydesktop

$ recordmydesktop <nombre.ogv>

To capture a window, we add position [x, y] and size [width (width), height (height)]

$ recordmydesktop -x 1 -y 1 --width 400 --height 200 -o <video.ogv>

I recommend creating a directory to store the video frames.

$ mkdir <directorio>

We take the frames of the video with mplayer.

The output of the images could be jpeg but it loses a lot of quality so I left png

$ mplayer -ao null <video.ogv> -vo png:outdir=<directorio>

Finally we create the gif

$ convert -delay 10x100 <directorio>/* <nombre.gif>

All these steps leave us a nice gif, but this gif that to be honest looks very decent weighs 4.2 mb

We "optimize" a bit

$ convert <nombre.gif> -fuzz 10% -layers Optimize <optNombre.gif>

Now we have a somewhat ugly gif… But. only weighs 262kb

gif_wadaAfter editing a bit, we can change the quality and weight with the parameter -fuzz

Here with 5% fuzz:


Weight: 335kb

Here with 2% fuzz


And that's it!

The content of the article adheres to our principles of editorial ethics. To report an error click here!.

10 comments, leave yours

Leave a Comment

Your email address will not be published. Required fields are marked with *



  1. Responsible for the data: Miguel Ángel Gatón
  2. Purpose of the data: Control SPAM, comment management.
  3. Legitimation: Your consent
  4. Communication of the data: The data will not be communicated to third parties except by legal obligation.
  5. Data storage: Database hosted by Occentus Networks (EU)
  6. Rights: At any time you can limit, recover and delete your information.

  1.   ezitoc said

    It's very good. And I didn't know about the "cmatrix" package. It's cool!

    Thank you very much.

  2.   Manual said

    I knew the Byzanz package, which directly does the .gif in a command:
    sleep 5 && byzanz-record -c -d 120 -w 1024 -h 768 -x 0 -y 0 test.gif

    1.    Wada said

      I also know that package 😀 I did not explain it in the post ... But the intention was to do it with the applications that I already had installed, I had mplayer and imagemagick just install recordmydesktop. And it's also because I avoid using AUR 😀

      1.    semperfidelis said

        A Wada question. What is the reason you avoid using the AUR?

  3.   rewsll said

    wao every time I am surprised linux is simply very versatile, thanks for the tutorial

  4.   poor taku said

    I exclusively used vi for 45 days or so, but after knowing emacs there is no return, sometimes I am tempted to fail vi when seeing captures like this, but emacs is so great (although it does not support curses in its shell mode).

  5.   eliotime3000 said

    That is amazing.

  6.   Rayonant said

    Very interesting, to be honest the subject of gifs is not very clear to me, but it is true that it can be very interesting to make a screencast with one of them!

  7.   NauTiluS said

    Interesting post.

    I archive it to have it for life 🙂