#gif #image

bin+lib gift

A library for reading and writing GIF images

12 releases (breaking)

✓ Uses Rust 2018 edition

0.9.1 Jun 25, 2020
0.8.0 May 20, 2020
0.5.0 Mar 28, 2020
0.3.1 May 29, 2019

#137 in Encoding

Download history 7/week @ 2020-03-14 19/week @ 2020-03-21 29/week @ 2020-03-28 14/week @ 2020-04-04 65/week @ 2020-04-11 12/week @ 2020-04-18 45/week @ 2020-04-25 6/week @ 2020-05-02 12/week @ 2020-05-09 33/week @ 2020-05-16 49/week @ 2020-05-23 65/week @ 2020-05-30 15/week @ 2020-06-06 42/week @ 2020-06-13 32/week @ 2020-06-20 19/week @ 2020-06-27

132 downloads per month
Used in ntcip

MIT/Apache

100KB
2.5K SLoC

GIFt

A Rust library for encoding and decoding GIF images.

Documentation

https://docs.rs/gift

Decoding example

use gift::Decoder;
use std::fs::File;

let gif = File::open("example.gif")?;
for step in Decoder::new(gif) {
    // was there a decoding error?
    let step = step?;
    let raster = step.raster();
    // ... work with raster
}

Utility

The library comes with a gift command-line utility, which can show the blocks within GIF files.

cargo install gift --features=cmd

lib.rs:

GIFt

A library for decoding and encoding GIF images and animations.

Decode Example

use gift::Decoder;

# fn main() -> Result<(), Box<dyn std::error::Error>> {
# let gif = &[
#   0x47, 0x49, 0x46, 0x38, 0x39, 0x61, 0x02, 0x00,
#   0x02, 0x00, 0x80, 0x01, 0x00, 0x00, 0x00, 0x00,
#   0xff, 0xff, 0xff, 0x2c, 0x00, 0x00, 0x00, 0x00,
#   0x02, 0x00, 0x02, 0x00, 0x00, 0x02, 0x03, 0x0c,
#   0x10, 0x05, 0x00, 0x3b,
# ][..];
// ... open a `File` as "gif"
for step in Decoder::new(gif) {
    // was there a decoding error?
    let step = step?;
    let raster = step.raster();
    // ... work with raster
}
# Ok(())
# }

Dependencies

~255–730KB
~16K SLoC