webpanimation

package module
v0.0.0-...-fa80d96 Latest Latest
Warning

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

Go to latest
Published: Dec 16, 2023 License: BSD-3-Clause Imports: 7 Imported by: 0

README

webpanimation

Package is binding to libwebp providing methods to create webp animations from golang image.Image interface

Installing

go get github.com/Magic-Xin/webpanimation

Examples

Check out examples folder

Dependencies

The only dependency is libwebp, it sources code are embeded in package so no additional installations are needed on machine. It can be updated to latest libwebp via ./generate_from_libwebp.py /path/to/clean/libwebp/src/

current libwebp version: v1.3.2

Documentation

Index

Constants

View Source
const (
	WebpMuxAbiVersion     = 0x0108
	WebpEncoderAbiVersion = 0x020f
)
View Source
const (
	WebpMuxOk              = WebPMuxError(C.WEBP_MUX_OK)
	WebpMuxNotFound        = WebPMuxError(C.WEBP_MUX_NOT_FOUND)
	WebpMuxInvalidArgument = WebPMuxError(C.WEBP_MUX_INVALID_ARGUMENT)
	WebpMuxBadData         = WebPMuxError(C.WEBP_MUX_BAD_DATA)
	WebpMuxMemoryError     = WebPMuxError(C.WEBP_MUX_MEMORY_ERROR)
	WebpMuxNotEnoughData   = WebPMuxError(C.WEBP_MUX_NOT_ENOUGH_DATA)
)

Variables

This section is empty.

Functions

func WebPAnimEncoderAdd

func WebPAnimEncoderAdd(webPAnimEncoder *WebPAnimEncoder, webPPicture *WebPPicture, timestamp int, webpcfg WebPConfig) int

func WebPAnimEncoderAssemble

func WebPAnimEncoderAssemble(webPAnimEncoder *WebPAnimEncoder, webPData *WebPData) int

func WebPAnimEncoderDelete

func WebPAnimEncoderDelete(webPAnimEncoder *WebPAnimEncoder)

func WebPAnimEncoderOptionsInitInternal

func WebPAnimEncoderOptionsInitInternal(webPAnimEncoderOptions *WebPAnimEncoderOptions) int

func WebPConfigInitInternal

func WebPConfigInitInternal(config WebPConfig) int

func WebPDataClear

func WebPDataClear(webPData *WebPData)

func WebPDataInit

func WebPDataInit(webPData *WebPData)

func WebPMuxDelete

func WebPMuxDelete(webPMux *WebPMux)

func WebPPictureFree

func WebPPictureFree(webPPicture *WebPPicture)

func WebPPictureImportRGBA

func WebPPictureImportRGBA(data []byte, stride int, webPPicture *WebPPicture) error

func WebPPictureInit

func WebPPictureInit(webPPicture *WebPPicture) int

Types

type WebPAnimEncoder

type WebPAnimEncoder C.WebPAnimEncoder

func WebPAnimEncoderNewInternal

func WebPAnimEncoderNewInternal(width, height int, webPAnimEncoderOptions *WebPAnimEncoderOptions) *WebPAnimEncoder

type WebPAnimEncoderOptions

type WebPAnimEncoderOptions C.WebPAnimEncoderOptions

func (*WebPAnimEncoderOptions) GetAnimParams

func (encOptions *WebPAnimEncoderOptions) GetAnimParams() WebPMuxAnimParams

func (*WebPAnimEncoderOptions) SetAllowMixed

func (encOptions *WebPAnimEncoderOptions) SetAllowMixed(v int)

func (*WebPAnimEncoderOptions) SetAnimParams

func (encOptions *WebPAnimEncoderOptions) SetAnimParams(v WebPMuxAnimParams)

func (*WebPAnimEncoderOptions) SetKmax

func (encOptions *WebPAnimEncoderOptions) SetKmax(v int)

func (*WebPAnimEncoderOptions) SetKmin

func (encOptions *WebPAnimEncoderOptions) SetKmin(v int)

func (*WebPAnimEncoderOptions) SetMinimizeSize

func (encOptions *WebPAnimEncoderOptions) SetMinimizeSize(v int)

func (*WebPAnimEncoderOptions) SetVerbose

func (encOptions *WebPAnimEncoderOptions) SetVerbose(v int)

type WebPConfig

type WebPConfig interface {
	SetLossless(v int)
	GetLossless() int
	SetMethod(v int)
	SetImageHint(v int)
	SetTargetSize(v int)
	SetTargetPSNR(v float32)
	SetSegments(v int)
	SetSnsStrength(v int)
	SetFilterStrength(v int)
	SetFilterSharpness(v int)
	SetAutofilter(v int)
	SetAlphaCompression(v int)
	SetAlphaFiltering(v int)
	SetPass(v int)
	SetShowCompressed(v int)
	SetPreprocessing(v int)
	SetPartitions(v int)
	SetPartitionLimit(v int)
	SetEmulateJpegSize(v int)
	SetThreadLevel(v int)
	SetLowMemory(v int)
	SetNearLossless(v int)
	SetExact(v int)
	SetUseDeltaPalette(v int)
	SetUseSharpYuv(v int)
	SetAlphaQuality(v int)
	SetFilterType(v int)
	SetQuality(v float32)
	// contains filtered or unexported methods
}

func NewWebpConfig

func NewWebpConfig() WebPConfig

NewWebpConfig create webpconfig instance

type WebPData

type WebPData C.WebPData

func (WebPData) GetBytes

func (wpd WebPData) GetBytes() []byte

type WebPMux

type WebPMux C.WebPMux

func WebPMuxCreateInternal

func WebPMuxCreateInternal(webPData *WebPData, copyData int) *WebPMux

type WebPMuxAnimParams

type WebPMuxAnimParams C.WebPMuxAnimParams

func (*WebPMuxAnimParams) SetBgcolor

func (wmap *WebPMuxAnimParams) SetBgcolor(v uint32)

func (*WebPMuxAnimParams) SetLoopCount

func (wmap *WebPMuxAnimParams) SetLoopCount(v int)

type WebPMuxError

type WebPMuxError int

func WebPMuxAssemble

func WebPMuxAssemble(webPMux *WebPMux, webPData *WebPData) WebPMuxError

func WebPMuxGetAnimationParams

func WebPMuxGetAnimationParams(webPMux *WebPMux, webPMuxAnimParams *WebPMuxAnimParams) WebPMuxError

func WebPMuxSetAnimationParams

func WebPMuxSetAnimationParams(webPMux *WebPMux, webPMuxAnimParams *WebPMuxAnimParams) WebPMuxError

type WebPPicture

type WebPPicture C.WebPPicture

func (WebPPicture) GetHeight

func (wpp WebPPicture) GetHeight() int

func (WebPPicture) GetWidth

func (wpp WebPPicture) GetWidth() int

func (*WebPPicture) SetHeight

func (wpp *WebPPicture) SetHeight(v int)

func (*WebPPicture) SetUseArgb

func (wpp *WebPPicture) SetUseArgb(v int)

func (*WebPPicture) SetWidth

func (wpp *WebPPicture) SetWidth(v int)

type WebpAnimation

type WebpAnimation struct {
	WebPAnimEncoderOptions *WebPAnimEncoderOptions
	Width                  int
	Height                 int

	AnimationEncoder *WebPAnimEncoder
	WebPData         *WebPData
	WebPMux          *WebPMux
	WebPPictures     []*WebPPicture
	// contains filtered or unexported fields
}

func NewWebpAnimation

func NewWebpAnimation(width, height, loopCount int) *WebpAnimation

NewWebpAnimation Initialize animation

func (*WebpAnimation) AddFrame

func (wpa *WebpAnimation) AddFrame(img image.Image, timestamp int, webpcfg WebPConfig) error

AddFrame add frame to animation

func (*WebpAnimation) Encode

func (wpa *WebpAnimation) Encode(w io.Writer) error

Encode encode animation

func (*WebpAnimation) ReleaseMemory

func (wpa *WebpAnimation) ReleaseMemory()

ReleaseMemory release memory

Directories

Path Synopsis
examples

Jump to

Keyboard shortcuts

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