webp

package module
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: Mar 9, 2024 License: MIT Imports: 16 Imported by: 2

README

webp

Status Go Reference

Go decoder for WebP Image File Format with support for animated WebP images.

Based on libwebp compiled to WASM and used with wazero runtime (CGo-free).

The library will first try to use a dynamic/shared library (if installed) via purego and will fall back to WASM.

Documentation

Overview

Package webp implements an WEBP image decoder based on libwebp compiled to WASM.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrMemRead  = errors.New("webp: mem read failed")
	ErrMemWrite = errors.New("webp: mem write failed")
	ErrDecode   = errors.New("webp: decode failed")
)

Errors .

Functions

func Decode

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

Decode reads a WEBP image from r and returns it as an image.Image.

func DecodeConfig

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

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

func Dynamic added in v0.2.2

func Dynamic() bool

Dynamic returns true when library is using the dynamic/shared library.

Types

type WEBP

type WEBP struct {
	// Decoded images.
	Image []*image.NRGBA
	// Delay times, one per frame, in milliseconds.
	Delay []int
}

WEBP represents the possibly multiple images stored in a WEBP file.

func DecodeAll

func DecodeAll(r io.Reader) (*WEBP, error)

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

Jump to

Keyboard shortcuts

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