gifenc

package module
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Feb 11, 2024 License: MIT Imports: 5 Imported by: 0

README

Gifenc

A Golang based GIF encoder/decoder

  • Convert GIFs to images and images to GIFs

Prerequisites

Quick Start

Import the gifenc package first.

package main

import (
	"github.com/Nota30/gifenc"
)

func main() {
	gify := gifenc.Config{}

	// Decode
	var gif *gif.GIF // Provide a gif
	imgs, err := gify.Decode(gif)
	if err != nil {
		println(err)
	}

    // Encode
	var images []image.Image // Provide an array of images
    encoded, err := gify.Encode(images)
    if err != nil {
		println(err)
	}
}

You can view examples in the test/test.go file.

Issues

  • This package uses Floyd–Steinberg dithering so the GIF result might not be what you expected.
  • Maybe adding other dithering algorithms at a later release?

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Delay  int // encode delay
	Width  int // decode width
	Height int // decode height
}

func (Config) Decode

func (config Config) Decode(gif *gif.GIF) ([]*image.RGBA, error)

Decode a gif. This will split the GIF into multiple images.

func (Config) Encode

func (config Config) Encode(images []image.Image) (*gif.GIF, error)

Encode a GIF. Provide an array of image to be combined into a GIF.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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