I often found myself wanting to be able to recording gifs straight out of a game or other application, but existing tools and libraries are severly lacking in a number of ways for that use case, so I wrote this library to solve the problem once and for all. It boasts the following features:
  • Easy to use. Single-header C code, compiles as C99 or C++98, and depends only on C standard library headers. Simple and minimal API.
  • High-quality results. Uses a straightforward palette selection and dithering algorithm that is guaranteed to provide equal fidelity for all areas of the image, thereby avoiding the artifacts that are typical of the kind of frequency-based adaptive color quantization algorithms used in most gif encoders.
  • Small file sizes. Uses delta encoding between frames and a compression-friendly dithering kernel, resulting in significantly smaller files than most gif encoders, without sacrificing quality.
  • Fast. Designed for speed, and uses SSE where available to encode at hundreds of megabytes a second, several times faster than comparable gif libraries.
  • Public domain. Also available under MIT license.
  • Actively maintained. This is not abandonware! If there is a problem or a feature you feel is missing, let me know and there's a good chance I can add it. Or submit a pull request if you're feeling generous - the code is relatively short and simple.

(Note: example gifs were recorded from my game Escher.)