gogif

package module
v0.0.0-...-16d5735 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 26, 2014 License: BSD-2-Clause Imports: 11 Imported by: 0

README

Hi! Please read the note below.

Aside from the median cut quantizer, this code has been merged into the Go standard library. I would strongly encourage you to use that instead :).

Contributors

Documentation

Overview

Package gif implements a GIF image decoder and encoder.

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

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Decode

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

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

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

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

Encode writes the Image m to w in GIF format.

func EncodeAll

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.

Types

type MedianCutQuantizer

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

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

type Options

type Options struct {
	Quantizer Quantizer
}

Options are the encoding parameters.

type Quantizer

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.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL