Documentation
¶
Overview ¶
Package webp implements an WEBP image decoder based on libwebp compiled to WASM.
Index ¶
- Constants
- Variables
- func Decode(r io.Reader) (image.Image, error)
- func DecodeConfig(r io.Reader) (image.Config, error)
- func Dynamic() error
- func Encode(w io.Writer, m image.Image, o ...Options) error
- func EncodeAll(w io.Writer, images []image.Image, o ...Options) error
- func Init()
- type Options
- type WEBP
Constants ¶
View Source
const DefaultDisposal = 0
DefaultDisposal is the default duration for animations.
View Source
const DefaultDuration = 50
DefaultDuration is the default duration for animations.
View Source
const DefaultMethod = 4
DefaultMethod is the default method encoding parameter.
View Source
const DefaultQuality = 75
DefaultQuality is the default quality encoding parameter.
Variables ¶
View Source
var ( ErrMemRead = errors.New("webp: mem read failed") ErrMemWrite = errors.New("webp: mem write failed") ErrDecode = errors.New("webp: decode failed") ErrEncode = errors.New("webp: encode failed") )
Errors .
Functions ¶
func DecodeConfig ¶
DecodeConfig returns the color model and dimensions of a WEBP image without decoding the entire image.
func Dynamic ¶
func Dynamic() error
Dynamic returns error (if there was any) during opening dynamic/shared library.
Types ¶
type Options ¶
type Options struct {
// Quality in the range [0,100]. Quality of 100 implies Lossless. Default is 75.
Quality int
// Lossless indicates whether to use the lossless compression. Lossless will ignore quality.
Lossless bool
// Method is quality/speed trade-off (0=fast, 6=slower-better). Default is 4.
Method int
// Exact preserve the exact RGB values in transparent area.
Exact bool
// UseExtendedFormat allows for metadata support. Only used for encoding
// animated images.
UseExtendedFormat bool
// Durations times, one per frame, in milliseconds.
Durations []int
// Disposals methods for frames after display; 0=keep, 1=clear to background.
Disposals []int
// LoopCount the number of times the animation loops; 0 for infinite.
LoopCount int
}
Options are the encoding parameters.
type WEBP ¶
type WEBP struct {
// Decoded images.
Image []image.Image
// Durations times, one per frame, in milliseconds.
Durations []int
// Disposals methods for frames after display; 0=keep, 1=clear to background.
Disposals []int
// LoopCount the number of times the animation loops; 0 for infinite.
LoopCount int
}
WEBP represents the possibly multiple images stored in a WEBP file.
Click to show internal directories.
Click to hide internal directories.