converter

package
v0.0.0-...-94fa381 Latest Latest
Warning

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

Go to latest
Published: Feb 9, 2026 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BatchConvert

func BatchConvert(inputPaths []string, outputDir string, opts Options, jobs int, progress chan<- Result)

func LoadImage

func LoadImage(path string) (image.Image, string, error)

func ParseSize

func ParseSize(sizeStr string) (int64, error)

Types

type AVIFEncoder

type AVIFEncoder struct{}

func (*AVIFEncoder) Encode

func (e *AVIFEncoder) Encode(w io.Writer, img image.Image, quality int) error

type Format

type Format string
const (
	FormatJPG  Format = "jpg"
	FormatPNG  Format = "png"
	FormatWebP Format = "webp"
	FormatAVIF Format = "avif"
)

type ImageEncoder

type ImageEncoder interface {
	Encode(w io.Writer, img image.Image, quality int) error
}

type JPEGEncoder

type JPEGEncoder struct{}

func (*JPEGEncoder) Encode

func (e *JPEGEncoder) Encode(w io.Writer, img image.Image, quality int) error

type Options

type Options struct {
	Format       Format
	Quality      int
	MaxSize      int64
	Overwrite    bool
	PreserveMeta bool
	Width        int
	Height       int
}

type PNGEncoder

type PNGEncoder struct{}

func (*PNGEncoder) Encode

func (e *PNGEncoder) Encode(w io.Writer, img image.Image, quality int) error

type Result

type Result struct {
	InputPath  string
	OutputPath string
	Error      error
}

func Convert

func Convert(inputPath, outputDir string, opts Options) Result

type WebPEncoder

type WebPEncoder struct{}

func (*WebPEncoder) Encode

func (e *WebPEncoder) Encode(w io.Writer, img image.Image, quality int) error

Jump to

Keyboard shortcuts

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