GIF libraries for C/C++
- GIFLIB is the reference GIF library, used by Android, GDAL and many Linux programs. It reads and writes every GIF block: frames, graphic control extensions (delays, disposal, transparency), comments and application extensions such as the Netscape loop. It gives you raw palette indices and frame rectangles: compositing animation frames and converting RGB to a palette are your job.
- stb_image is a single public-domain header that decodes GIF to RGBA.
stbi_load_gif_from_memoryreturns all animation frames already composited on the canvas, with their delays. It can’t write GIF.
To create GIFs from RGB frames you need a color quantizer: libimagequant (GPL-3.0 or commercial; the quantizer behind pngquant and gifski), or a simple median-cut / octree you write yourself. cgif (MIT) is a small, fast encoder for animated GIFs from indexed frames, used by libvips. The public-domain single-header gif-h writes animated GIFs from RGBA frames with a built-in quantizer.
- GIFLIB GIFLIB is the reference C library for reading and writing GIF. How to decode all frames with DGifSlurp, read delays and disposal.
- stb_image stb_image is a single-header, public-domain C library that decodes GIF and animated GIF to RGBA. How to load the first frame, load all frames with delays.