imageprep

package
v0.8.3 Latest Latest
Warning

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

Go to latest
Published: Oct 14, 2026 License: Apache-2.0, MIT Imports: 14 Imported by: 0

Documentation

Overview

Package imageprep turns stored image bytes into an image a model will take: converted to a format the vendor documents and shrunk to its size limit. Embedding and rerank both send images and share these rules.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Prepare

func Prepare(data []byte, limits Limits) (api.EmbedImage, error)

Prepare turns stored image bytes into an image the model will take. An image already in an accepted format and within the byte limit goes as it is; anything else is re-encoded — as JPEG where the vendor takes it, PNG otherwise — and scaled down until it fits.

Types

type Limits

type Limits struct {
	MaxBytes  int
	MIMETypes []string
}

Limits describes what one image may be. Zero values mean the vendor documents no limit.

func LimitsOf

func LimitsOf(in api.ImageInput) Limits

LimitsOf renders an endpoint's image settings as Limits.

Jump to

Keyboard shortcuts

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