meme x giffy

The other week I was tinkering with editing GIF animations in Emacs, and then I started wondering: Can this be any more ridiculous?

Yes.

So it’s a mashup of the Emacs meme mode and the new GIF animation code.  I spent most of the time on this wondering whether I could somehow make one or the other a minor mode before giving up and just mashed the code into meme.el, which can be found on Github.

The main challenge here was figuring out how to make this fast enough.  The first naive implementation just created an SVG 25 times a second with all the data in it, and Emacs just isn’t fast enough to print a ~2MB XML structure that often.  (Not to mention when animating bluray screen grabs: The SVG structure is then about 7MB.)

So I cheated and pre-computed the screengrab bits, and then plonked down those bits into the printed XML structure.  Which made it fast enough even for bluray animations on my rather spiffy machine; your mileage may vary.  If your machine is too slow, you may have to pre-downscale the screengrabs the animations are based on.

Exporting to GIF and MP4 is supported if you have ImageMagick “convert” and “ffpmeg” installed.

 

Leave a Reply