imageutil

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Nov 24, 2026 License: Apache-2.0 Imports: 10 Imported by: 2 modules, 1 package

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LoadImagesFromPaths

func LoadImagesFromPaths(ctx context.Context, paths []string) ([]image.Image, error)

func ResizeRGB added in v0.8.2

func ResizeRGB(img image.Image, width, height, resample int) (image.Image, error)

ResizeRGB uses Pillow-compatible antialiased bilinear (2) or bicubic (3) interpolation with explicit output dimensions and opaque RGB output.

Types

type CenterCropPreprocessor

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

func CenterCropStep

func CenterCropStep(targetWidth, targetHeight int) *CenterCropPreprocessor

func (*CenterCropPreprocessor) Apply

type NormalizationStep

type NormalizationStep interface {
	Apply(r, g, b float32) (float32, float32, float32)
}

type PixelNormalizationPreprocessor

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

func CLIPPixelNormalizationStep added in v0.6.0

func CLIPPixelNormalizationStep() *PixelNormalizationPreprocessor

CLIPPixelNormalizationStep returns CLIP's normalization values. Use after RescaleStep() to normalize to 0-1 range first.

func ImagenetPixelNormalizationStep

func ImagenetPixelNormalizationStep() *PixelNormalizationPreprocessor

func PixelNormalizationStep

func PixelNormalizationStep(mean, std [3]float32) *PixelNormalizationPreprocessor

func (*PixelNormalizationPreprocessor) Apply

type PreprocessStep

type PreprocessStep interface {
	Apply(img image.Image) (image.Image, error)
}

type RescalePreprocessor

type RescalePreprocessor struct{}

func RescaleStep

func RescaleStep() *RescalePreprocessor

func (*RescalePreprocessor) Apply

func (s *RescalePreprocessor) Apply(r, g, b float32) (float32, float32, float32)

type ResizePreprocessor

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

func ResizeBicubicStep added in v0.8.3

func ResizeBicubicStep(targetSize int) *ResizePreprocessor

ResizeBicubicStep resizes the shortest edge using Pillow bicubic (resample 3). CLIP's processor uses this before the center crop.

func ResizeBilinearStep added in v0.8.2

func ResizeBilinearStep(targetSize int) *ResizePreprocessor

ResizeBilinearStep resizes the shortest edge using antialiased bilinear interpolation. ResizeStep retains its original nearest-neighbor behavior.

func ResizeStep

func ResizeStep(targetSize int) *ResizePreprocessor

func (*ResizePreprocessor) Apply

func (s *ResizePreprocessor) Apply(img image.Image) (image.Image, error)

Jump to

Keyboard shortcuts

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