GIF libraries for Rust
- gif is a pure-Rust streaming GIF decoder and encoder. It returns frames as stored (with position, delay, disposal and palette), decodes to indexed or RGBA pixels, and encodes from indexed or RGBA frames with a built-in NeuQuant quantizer. Use it when you need GIF-level control or low memory use.
- image uses the gif crate and adds compositing: its
AnimationDecoderreturns full-canvas RGBA frames with delays, andGifEncoderwrites a sequence of RGBA frames with a loop setting. Use it when you work with several formats or want to resize and edit frames.
For better palettes, imagequant (libimagequant, GPL-3.0 or commercial) and color_quant (NeuQuant, MIT) produce indexed frames you feed to the gif crate. The gifski encoder is available as a crate too (AGPL-3.0).
- gif The gif crate is a pure-Rust GIF decoder and encoder. How to decode frames to RGBA, read delays and disposal, write an animated GIF that loops.
- image The image crate decodes and encodes GIF and animated GIF in Rust. How to get composited frames with delays, resize an animated GIF, write a looping animation.