compressor

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Feb 25, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrWebPNotSupported = errors.New("WebP support is not available in this build (requires CGO and libwebp)")

ErrWebPNotSupported is returned when WebP functionality is not available This error is only used in the no-CGO build, but declared here for API consistency

Functions

func CompressJPEG

func CompressJPEG(inputPath, outputPath string, quality int) error

Обёртка для сжатия файла.

func CompressToWebP added in v0.2.0

func CompressToWebP(inputPath, outputPath string, quality int) error

CompressToWebP reads a JPEG and saves it as WebP

func ConvertToWebP added in v0.2.0

func ConvertToWebP(img image.Image, outputPath string, quality int) (err error)

ConvertToWebP converts an image to WebP format with the specified quality

Types

type Compressor

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

func New

func New(quality int) *Compressor

Создаёт Compressor. Качество ограничивается диапазоном 1-100.

func (*Compressor) Compress

func (c *Compressor) Compress(img image.Image) ([]byte, error)

Compress image.Image and return bytes.

func (*Compressor) CompressFile

func (c *Compressor) CompressFile(inputPath, outputPath string) (err error)

CompressFile сжимает JPEG файл.

func (*Compressor) Quality

func (c *Compressor) Quality() int

Jump to

Keyboard shortcuts

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