gifutil

package module
v0.0.0-...-675d4bc Latest Latest
Warning

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

Go to latest
Published: Aug 2, 2017 License: MIT Imports: 5 Imported by: 2

README

gifutil

gifutil makes use of the gif.GIF struct found in the "image/gif" library. This struct, although useful, is relatively manual, requiring one to edit the fields and set up the options themselves. As such, I have created this library as a supplement to "image/gif", containing useful functions to help create and manage these data structures.

NOTE: This library offers basic creation and output of gifs. If one requires more advanced features such as Disposal Methods, they will have to edit the GIF struct themselves.

Documentation can be found at https://godoc.org/github.com/daviswithanS/gifutil.

Documentation

Overview

Package gifutil contains utility functions for working with standard library "image/gif" GIF structs.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AttachImage

func AttachImage(g *gif.GIF, img *image.Image)

AttachImage appends an Image to a GIF struct's set of frames.

func AttachImageDelayed

func AttachImageDelayed(g *gif.GIF, img *image.Image, delay int)

AttachImageDelayed appends an Image to a GIF struct's set of frames, as well as a delay measured in hundredths of a second

func NewFiniteGIF

func NewFiniteGIF(pal color.Palette, width, height, loopCount int) *gif.GIF

NewFiniteGIF creates a new, empty GIF struct that loops a fixed number of times.

func NewGIF

func NewGIF(pal color.Palette, width, height int) *gif.GIF

NewGIF creates a new, empty GIF struct that loops indefinitely.

func Populate

func Populate(g *gif.GIF, frames int, fg FrameGetter)

Populate provides a framework for populating an empty gif with frames according to a custom function defined by the user.

func WriteToFile

func WriteToFile(g *gif.GIF, filename string) error

WriteToFile encodes a GIF struct into a file of the given filename.

Types

type FrameGetter

type FrameGetter interface {
	GetFrame(int) *image.Image
}

FrameGetter is an interface used by the Populate() function. All that is required to implement it is a function that, when given a frame number, returns the corresponding image associated with that frame.

Directories

Path Synopsis
examples
cycloid
cycloid.go creates a gif demonstrating a cycloid - the shape that is formed when you trace one point on a rolling circle.
cycloid.go creates a gif demonstrating a cycloid - the shape that is formed when you trace one point on a rolling circle.
flower
flower.go creates a gif of a flower - that is, a shape formed by the polar equation r = k * cos(p * theta), where k is the radius of the final product and p is the number of petals.
flower.go creates a gif of a flower - that is, a shape formed by the polar equation r = k * cos(p * theta), where k is the radius of the final product and p is the number of petals.

Jump to

Keyboard shortcuts

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