encoder

package
Version: v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Aug 18, 2021 License: MIT Imports: 6 Imported by: 5

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