Documentation ¶
Overview ¶
Package avif implements an AVIF image decoder based on libavif compiled to WASM.
Index ¶
Constants ¶
const DefaultQuality = 60
DefaultQuality is the default quality encoding parameter.
const DefaultSpeed = 10
DefaultSpeed is the default speed encoding parameter.
Variables ¶
var ( ErrMemRead = errors.New("avif: mem read failed") ErrMemWrite = errors.New("avif: mem write failed") ErrDecode = errors.New("avif: decode failed") ErrEncode = errors.New("avif: encode failed") )
Errors .
Functions ¶
func DecodeConfig ¶
DecodeConfig returns the color model and dimensions of a AVIF image without decoding the entire image.
func Dynamic ¶ added in v0.2.1
func Dynamic() error
Dynamic returns error (if there was any) during opening dynamic/shared library.
func InitDecoder ¶ added in v0.4.0
func InitDecoder()
InitDecoder initializes wazero runtime and compiles the module. This function does nothing if a dynamic/shared library is used and Dynamic() returns nil. There is no need to explicitly call this function, first Decode will initialize the runtime.
func InitEncoder ¶ added in v0.4.0
func InitEncoder()
InitEncoder initializes wazero runtime and compiles the module. This function does nothing if a dynamic/shared library is used and Dynamic() returns nil. There is no need to explicitly call this function, first Encode will initialize the runtime.
Types ¶
type AVIF ¶ added in v0.1.5
type AVIF struct { // Decoded images, NRGBA or NRGBA64. Image []image.Image // Delay times, one per frame, in seconds. Delay []float64 }
AVIF represents the possibly multiple images stored in a AVIF file.
type Options ¶ added in v0.2.5
type Options struct { // Quality in the range [0,100]. Quality of 100 implies lossless. Default is 60. Quality int // Quality in the range [0,100]. QualityAlpha int // Speed in the range [0,10]. Slower should make for a better quality image in less bytes. Speed int // Chroma subsampling, 444|422|420. ChromaSubsampling image.YCbCrSubsampleRatio }
Options are the encoding parameters.