std/gif
On this page
Index
- type
GifErr- method
GifErr.display
- method
- type
Config - type
Gif - fn
decode - fn
decode_all - fn
decode_config - fn
encode - fn
encode_all
Types
GifErr
struct GifErr {
msg: Str
}Go’s error texts: gif: not enough image data, gif: too much image data, gif: invalid pixel value, gif: reading frames: unexpected EOF,
gif: can't recognize format "GIF90a", gif: image is too large to encode, image too large (more than max_pixels) and the rest of
image/gif’s.
GifErr.display
fn (e: GifErr) display() -> StrConfig
struct Config {
width: Int
height: Int
palette: List[Int]
}What DecodeConfig returns: the logical screen and the global color table (empty when there is none).
Gif
struct Gif {
frames: List[image.Image]
delay: List[Int]
disposal: List[Int]
loop_count: Int
width: Int
height: Int
palette: List[Int]
background_index: Int
}Go’s gif.GIF: the frames in order (each a Paletted Image whose min_x and min_y are the frame’s offset on the screen), the delays in 100ths of a second, the disposal methods (0 to 3; empty means none: Go’s nil), the loop count (-1: no loop extension, 0: forever, n: n times after the first run), the screen size and global palette (empty: none) and the background color index.
Functions
decode
fn decode(data: Bytes, max_pixels: Int = 100000000) -> image.Image ! GifErrGo’s gif.Decode: the first frame. A screen or frame of more than max_pixels pixels is refused before anything is allocated.
decode_all
fn decode_all(data: Bytes, max_pixels: Int = 100000000) -> Gif ! GifErrGo’s gif.DecodeAll.
decode_config
fn decode_config(data: Bytes) -> Config ! GifErrGo’s gif.DecodeConfig.
encode
fn encode(im: image.Image, num_colors: Int = 256) -> Bytes ! GifErrGo’s gif.Encode with Options{NumColors: num_colors} (1 to 256, else 256) and its default Floyd-Steinberg drawer: a Paletted image with at most num_colors entries is written as it is, any other image is drawn onto the first num_colors entries of the Plan 9 palette.
encode_all
fn encode_all(g: Gif) -> Bytes ! GifErrGo’s gif.EncodeAll.
↑ index