Posted on September 30, 2017 by phoe

[Tags: gif common-lisp skippy]

Animated GIF files are most often optimized - if frame 2 only changes a small region of frame 1, then the surplus data is not duplicated, and instead only a rectangle containing the changed pixels is saved in the file, along with the offset information.

This is good for compression, but bad for programmers. For the purpose of image processing, I needed a way to "flatten" the GIF frames, as in, get all the full-sized frames. And for this, it turned out, I needed a full GIF renderer, because after the first frame, the output of frame X always depends on the output of frame X-1 .

I utilized the SKIPPY library for GIF processing, but found out that it did not have a GIF renderer. So it turned out that I need to write one, which I did. And now Common Lisp has a GIF renderer written in portable Common Lisp.

It still needs a bit of work to support the little-used "Restore To Previous" GIF disposal mode, but works well enough otherwise.

See the code here. I might package it separately if there is demand for it. UPDATE: It is packaged and was submitted to Quicklisp.