kornelski/image-gif-dispose

Implements GIF disposal method (full rendering of frames) for the Rust gif crate

Rust

21

34 commits

updated Feb 4, 2026

See the code

README

Please dispose of GIF frames properly

This crate implements GIF disposal method for the gif crate.

The gif crate only exposes raw frame data that is not sufficient to render animated GIFs properly. GIF requires special composing of frames which is non-trivial.

Usage

let file = File::open("example.gif")?;

let mut gif_opts = gif::DecodeOptions::new();
// Important:
gif_opts.set_color_output(gif::ColorOutput::Indexed);

let mut decoder = gif_opts.read_info(file)?;
let mut screen = gif_dispose::Screen::new_decoder(&decoder);

while let Some(frame) = decoder.read_next_frame()? {
    screen.blit_frame(&frame)?;
    screen.pixels // that's the frame now in RGBA format
}

The screen.pixels buffer uses ImgVec to represent a 2D image.

See examples/explode.rs for more.

Requirements

  • Latest stable Rust (1.45+)
animated-gif
frames
gif
gif-disposal
gif-library

kornelski/image-gif-dispose

Implements GIF disposal method (full rendering of frames) for the Rust gif crate

Rust

21

34 commits

updated Feb 4, 2026

See the code

README

Please dispose of GIF frames properly

This crate implements GIF disposal method for the gif crate.

The gif crate only exposes raw frame data that is not sufficient to render animated GIFs properly. GIF requires special composing of frames which is non-trivial.

Usage

let file = File::open("example.gif")?;

let mut gif_opts = gif::DecodeOptions::new();
// Important:
gif_opts.set_color_output(gif::ColorOutput::Indexed);

let mut decoder = gif_opts.read_info(file)?;
let mut screen = gif_dispose::Screen::new_decoder(&decoder);

while let Some(frame) = decoder.read_next_frame()? {
    screen.blit_frame(&frame)?;
    screen.pixels // that's the frame now in RGBA format
}

The screen.pixels buffer uses ImgVec to represent a 2D image.

See examples/explode.rs for more.

Requirements

  • Latest stable Rust (1.45+)
animated-gif
frames
gif
gif-disposal
gif-library

Project health

Overall

1.5/10

Maintained

0/10

Code review

0/10
OpenSSF Scorecard

Significant stargazers

Kaur Kuut

44 followers · starred Dec 2019

Daniel Collin

529 followers · starred Dec 2023