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
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.
$ 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
Here with 5% fuzz:
Here with 2% fuzz
And that's it!