Encode / Decode
gif.Encode(w, img, nil)
img, _ := gif.Decode(r)
image/gifEncode and decode GIF (including animated). Palette-based.
gif.Encode(w, img, nil)
img, _ := gif.Decode(r)
g := &gif.GIF{
Image: []*image.Paletted{frame1, frame2},
Delay: []int{10, 10}, // 100ths of a second
LoopCount: 0, // infinite
}
gif.EncodeAll(w, g)
g, _ := gif.DecodeAll(r)
for i, frame := range g.Image {
fmt.Println(i, g.Delay[i], frame.Bounds())
}