encoder

package
v1.0.6 Latest Latest
Warning

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

Go to latest
Published: Jan 24, 2026 License: MIT Imports: 7 Imported by: 69 modules, 55 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Encoder

type Encoder struct {
	// contains filtered or unexported fields
}

Encoder stores information to encode image

func NewEncoder

func NewEncoder(src image.Image, options *Options) (e *Encoder, err error)

NewEncoder return new encoder instance

func (*Encoder) Encode

func (e *Encoder) Encode(w io.Writer) error

Encode picture and flush to io.Writer

type EncodingPreset

type EncodingPreset int

EncodingPreset using Preset

const (
	PresetDefault EncodingPreset = iota
	PresetPicture
	PresetPhoto
	PresetDrawing
	PresetIcon
	PresetText
)

Default libwebp presets noinspection GoUnusedConst

type ImageHint

type ImageHint int

ImageHint hint of picture

const (
	HintDefault ImageHint = iota
	HintPicture
	HintPhoto
	HintGraph
	HintLast
)

Default libwebp image hints noinspection GoUnusedConst

type Options

type Options struct {
	Lossless         bool
	Quality          float32
	Method           int
	ImageHint        ImageHint
	TargetSize       int
	TargetPsnr       float32
	Segments         int
	SnsStrength      int
	FilterStrength   int
	FilterSharpness  int
	FilterType       int
	Autofilter       bool
	AlphaCompression int
	AlphaFiltering   int

	Pass int
	// Disabled for compatibility with old version libwebp
	// QMin             int
	// QMax             int
	ShowCompressed  bool
	Preprocessing   int
	Partitions      int
	PartitionLimit  int
	EmulateJpegSize bool
	ThreadLevel     bool
	LowMemory       bool
	NearLossless    int
	Exact           int
	UseDeltaPalette bool
	UseSharpYuv     bool
	// contains filtered or unexported fields
}

Options specifies webp encoding parameters

func NewLosslessEncoderOptions

func NewLosslessEncoderOptions(preset EncodingPreset, level int) (options *Options, err error)

NewLosslessEncoderOptions build lossless encoding options

func NewLossyEncoderOptions

func NewLossyEncoderOptions(preset EncodingPreset, quality float32) (options *Options, err error)

NewLossyEncoderOptions build lossy encoding options

func (*Options) GetConfig

func (o *Options) GetConfig() (*C.WebPConfig, error)

GetConfig build WebPConfig for libwebp

Jump to

Keyboard shortcuts

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