webp

package
v0.0.0-...-9e4386a Latest Latest
Warning

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

Go to latest
Published: Jul 7, 2024 License: MIT, BSD-3-Clause Imports: 8 Imported by: 0

Documentation

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 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.

Types

type ALPHHeader

type ALPHHeader struct {
	Preprocessing   uint8
	FilteringMethod uint8
	Compression     uint8
}

type ANIMHeader

type ANIMHeader struct {
	BackgroundColor color.Color
	LoopCount       uint16
}

type ANMFHeader

type ANMFHeader struct {
	FrameX         uint32
	FrameY         uint32
	FrameWidth     uint32
	FrameHeight    uint32
	FrameDuration  uint32
	BlendBitSet    bool
	DisposalBitSet bool
}

type AnimatedWEBP

type AnimatedWEBP struct {
	Frames []Frame
	Header ANIMHeader
	Config image.Config
}

AnimatedWEBP is the struct of a AnimatedWEBP container and the image data contained within.

func DecodeAnimated

func DecodeAnimated(r io.Reader) (*AnimatedWEBP, error)

type Frame

type Frame struct {
	Header ANMFHeader
	Frame  image.Image
}

type VP8XHeader

type VP8XHeader struct {
	ICCProfile   bool
	Alpha        bool
	ExifMetadata bool
	XmpMetadata  bool
	Animation    bool
	CanvasWidth  uint32
	CanvasHeight uint32
}

func DecodeVP8XHeader

func DecodeVP8XHeader(r io.Reader) (*VP8XHeader, error)

DecodeVP8XHeader will return the decoded VP8XHeader if this file is in the Extended File Format as defined by the webp specification. The VP8X chunk must be the first chunk of the file. If the first chunk of the file is anything else, it is not in the extended format and this will return a nil VP8XHeader. An error is only returned if the chunk is found, but invalid or a generic io.Reader error occurs.

Jump to

Keyboard shortcuts

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