Bonus: A quick two-step framebuffer animated gif

The animated gif trick is getting a little more attention than I thought it would. I would never want to be thought a holdout, but the original explanation was buried in some comments.

So here’s a quick script that I use, plus the one-liner that actually makes the gif.

For this you’ll need only fbgrab and imagemagick, although I guess those could be replaced by alternative programs. To the best of my knowledge, neither of those requires anything from Xorg, but that might depend on your distro.

First, something I call “gifgrab,” which starts from another virtual terminal:

mkdir ~/gifgrab
cd ~/gifgrab
sleep 3; for i in {100..999} ; do fbgrab `date +%Y-%m-%d`-${HOSTNAME}-${1}-${i}.png ; done

You can go ahead and laugh at my programming ability now. 😳

The sleep command gives me time to switch to the “desktop” from the alternative tty. I loop from 100 to 999 only because I like the digits to line up pretty in the folder :roll:, and those numbers will be ignored anyway, once the pngs become a gif.

I should mention that I usually CTRL+C out of the script, which means the last png in the folder may be an incomplete image. Just for safety I delete that last one.

I like to keep the png files together in a folder in a predictable space, mostly because the next command is rather laborious, and so I’ll rsync that folder to a faster machine, and actually convert it later.

And here’s the conversion command, from inside the folder with the pngs.

convert -delay 75 -loop 0 2013* 2013-05-15-solo-2150-title.gif

You should change the filenames to whatever. I use a delay of 75, only because the “framerate” tends to me more than a second, and otherwise the gif gets long and boring. The loop flag tells imagemagick to let it repeat indefinitely.

I think that’s all. If you find a way to streamline this, I am always interested. Cheers. 🙂

Edit, 2013-05-16: I should note that this “technique” will work on a standard Xorg desktop too, if you use the proper screenshot tool. For example, if you substitute scrot for fbgrab in the gifgrab script, you get an identical effect, for X.

5 thoughts on “Bonus: A quick two-step framebuffer animated gif

  1. Yu-Jie Lin

    Bash’s Brace Expansion can prefix zeros, so {001..999} would do fine for aligning the digits, though, like you said, the numbers will be ignored. Just a tip.

    1. K.Mandla Post author

      Thanks, I knew it should be able to do this. It was a little strange to Google for it though. Cheers! 😀

  2. Pingback: imagemagick: Graphics, ungraphically | Inconsolation

  3. Pingback: mplayer: At the framebuffer, or without | Inconsolation

  4. mb

    Any tips for playing an animated gif on the framebuffer? fbv and fbi seem to only show a still.

Comments are closed.