processing

package
v0.0.0-...-1c22dfd Latest Latest
Warning

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

Go to latest
Published: Sep 16, 2025 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Processor

type Processor struct{}

Processor handles image processing operations

func NewProcessor

func NewProcessor() *Processor

NewProcessor creates a new image processor

func (*Processor) CalculateOptimalCropBox

func (p *Processor) CalculateOptimalCropBox(centerX, centerY float64, targetWidth, targetHeight, imgWidth, imgHeight int, zoom float64) types.Box

CalculateOptimalCropBox calculates the optimal crop box for given aspect ratio centered at a point

func (*Processor) CreateDebugOverlay

func (p *Processor) CreateDebugOverlay(img image.Image, modelBox, cropBox types.Box, cropCx, cropCy float64) image.Image

CreateDebugOverlay creates an overlay image showing detection and crop boxes

func (*Processor) CropImageToBox

func (p *Processor) CropImageToBox(img image.Image, box types.Box, targetWidth, targetHeight int) (image.Image, error)

CropImageToBox crops an image to the specified normalized box

func (*Processor) FindNearestPointToCenter

func (p *Processor) FindNearestPointToCenter(box types.Box) (float64, float64)

FindNearestPointToCenter finds the nearest point in a box to the image center

func (*Processor) LoadImage

func (p *Processor) LoadImage(path string) (image.Image, error)

LoadImage loads an image from a file path with WebP support

func (*Processor) LoadImageFromURL

func (p *Processor) LoadImageFromURL(imageURL string) (image.Image, error)

LoadImageFromURL downloads and loads an image from a URL

func (*Processor) LoadImageSmart

func (p *Processor) LoadImageSmart(source string) (image.Image, error)

LoadImageSmart loads an image from either a file path or URL

func (*Processor) PrepareImageForModel

func (p *Processor) PrepareImageForModel(img image.Image, format string, maxDim int, quality int) (string, error)

PrepareImageForModel converts an image to base64 for sending to vision models

func (*Processor) SaveImage

func (p *Processor) SaveImage(img image.Image, path, format string, quality int, lossless bool) error

SaveImage saves an image to a file with the specified format and quality

Jump to

Keyboard shortcuts

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