resize

package
v0.0.0-...-57218f6 Latest Latest
Warning

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

Go to latest
Published: Dec 22, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ModeAspectFitStr = "fit"
	ModeFillStr      = "fill"
	ModeStretchStr   = "stretch"
)

String representations of resize modes

Variables

This section is empty.

Functions

func Resize

func Resize(img image.Image, opts ResizeOptions) (image.Image, error)

Resize resizes the image according to the specified options

Types

type ResizeMode

type ResizeMode int

ResizeMode defines how the image should be resized

const (
	ModeAspectFit ResizeMode = iota // Maintain aspect ratio, fit within dimensions
	ModeFill                        // Fill the dimensions, crop if necessary
	ModeStretch                     // Stretch/squish to exactly match dimensions
)

func ParseResizeMode

func ParseResizeMode(mode string) (ResizeMode, error)

ParseResizeMode converts a string to ResizeMode

type ResizeOptions

type ResizeOptions struct {
	Width  int
	Height int
	Mode   ResizeMode
	Filter imaging.ResampleFilter
}

ResizeOptions contains all options for image resizing

Jump to

Keyboard shortcuts

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