encoder

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Aug 9, 2023 License: MIT Imports: 6 Imported by: 0

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 {
	AlphaFiltering   int
	PartitionLimit   int
	AlphaCompression int
	ImageHint        ImageHint
	TargetSize       int
	Exact            int
	Segments         int
	SnsStrength      int
	FilterStrength   int
	FilterSharpness  int
	FilterType       int
	NearLossless     int
	Method           int

	Partitions      int
	Pass            int
	Preprocessing   int
	Quality         float32
	TargetPsnr      float32
	ShowCompressed  bool
	ThreadLevel     bool
	EmulateJpegSize bool
	UseSharpYuv     bool
	LowMemory       bool
	Autofilter      bool
	UseDeltaPalette bool
	Lossless        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