Crate gif
GIF en- and decoding library 
GIF en- and decoder written in Rust (API Documentation).
GIF encoding and decoding library
This library provides all functions necessary to de- and encode GIF files.
High level interface
The high level interface consists of the two types
Encoder and Decoder.
Decoding GIF files
// Open the file
use File;
let mut decoder = new;
// Configure the decoder such that it will expand the image to RGBA.
decoder.set_color_output;
// Read the file header
let file = open.unwrap;
let mut decoder = decoder.read_info.unwrap;
while let Some = decoder.read_next_frame.unwrap
Encoding GIF files
The encoder can be used so save simple computer generated images:
use ;
use File;
use Cow;
let color_map = &;
let = ;
let mut beacon_states = ;
let mut image = create.unwrap;;
let mut encoder = new.unwrap;
encoder.set_repeat.unwrap;
for state in &beacon_states
Frame::from_* can be used to convert a true color image to a paletted
image with a maximum of 256 colors:
#
Modules
-
streaming_decoder
Low-level, advanced decoder. Prefer
Decoderinstead, which can stream frames too.
Structs
- AnyExtension A newtype wrapper around an arbitrary extension ID.
-
DecodeOptions
Options for opening a GIF decoder.
DecodeOptions::read_infowill start the decoder. -
Decoder
GIF decoder. Create
DecodeOptionsto get started, and callDecodeOptions::read_info. - DecodingFormatError An error returned in the case of the image not being formatted properly.
- Encoder GIF encoder.
- Frame A GIF frame
Enums
- ColorOutput Output mode for the image data
- DecodingError Decoding error.
- DisposalMethod Disposal method
- EncodingError Encoding error.
- EncodingFormatError The image has incorrect properties, making it impossible to encode as a gif.
- Extension Known GIF extension labels.
- ExtensionData Extension data.
- MemoryLimit The maximum amount of memory the decoder is allowed to use for each frame
- Repeat Number of repetitions
- Version One version number of the GIF standard.