gogif: github.com/andybons/gogif Index | Files | Directories

package gogif

import "github.com/andybons/gogif"

Package gif implements a GIF image decoder and encoder.

The GIF specification is at http://www.w3.org/Graphics/GIF/spec-gif89a.txt.


Package Files

mediancut.go reader.go writer.go

func Decode Uses

func Decode(r io.Reader) (image.Image, error)

Decode reads a GIF image from r and returns the first embedded image as an image.Image.

func DecodeAll Uses

func DecodeAll(r io.Reader) (*gif.GIF, error)

DecodeAll reads a GIF image from r and returns the sequential frames and timing information.

func DecodeConfig Uses

func DecodeConfig(r io.Reader) (image.Config, error)

DecodeConfig returns the global color model and dimensions of a GIF image without decoding the entire image.

func Encode Uses

func Encode(w io.Writer, m image.Image, o *Options) error

Encode writes the Image m to w in GIF format.

func EncodeAll Uses

func EncodeAll(w io.Writer, g *gif.GIF) error

EncodeAll writes the images in g to w in GIF format with the given loop count and delay between frames.

type MedianCutQuantizer Uses

type MedianCutQuantizer struct {
    NumColor int

MedianCutQuantizer constructs a palette with a maximum of NumColor colors by iteratively splitting clusters of color points mapped on a three-dimensional (RGB) Euclidian space. Once the number of clusters is within the specified bounds, the resulting color is computed by averaging those within each grouping.

func (*MedianCutQuantizer) Quantize Uses

func (q *MedianCutQuantizer) Quantize(dst *image.Paletted, r image.Rectangle, src image.Image, sp image.Point)

type Options Uses

type Options struct {
    Quantizer Quantizer

Options are the encoding parameters.

type Quantizer Uses

type Quantizer interface {
    // Quantize sets dst.Palette as well as dst's pixels.
    Quantize(dst *image.Paletted, r image.Rectangle, src image.Image, sp image.Point)

A Quantizer interface is used by an encoder to construct an image with a restricted color palette.



Package gogif imports 11 packages (graph) and is imported by 4 packages. Updated 2016-07-18. Refresh now. Tools for package owners.