mediaimage

package
v0.0.10 Latest Latest
Warning

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

Go to latest
Published: Jul 1, 2026 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MaxReadBytes        = 20 << 20
	MaxVisionDimension  = 1568
	MaxToolBase64Budget = 24 << 10
	MaxUserAttachBytes  = 5 << 20
	MaxUserAttachments  = 4
)

Variables

View Source
var (
	ErrUnsupportedMedia = errors.New("unsupported media type")
	ErrVideoUnsupported = errors.New("video files are not supported yet")
)

Functions

func DecodeConfig

func DecodeConfig(r io.Reader) (width, height int, err error)

DecodeConfig reports image dimensions without full decode when possible.

func FormatToolResult

func FormatToolResult(relPath, mime string, width, height int, data []byte) string

FormatToolResult builds ReadMediaFile tool output with metadata and base64 PNG.

func Normalize

func Normalize(data []byte, mimeHint string) ([]byte, string, int, int, error)

Normalize decodes an image, optionally downscales, and re-encodes as PNG.

func ReadPath

func ReadPath(path string) (data []byte, mime string, width, height int, err error)

ReadPath reads an image file and returns normalized PNG bytes for vision APIs.

func SaveAttachment

func SaveAttachment(workDir, sessionSuffix string, data []byte) (absPath, relPath string, err error)

SaveAttachment writes PNG bytes under <workDir>/.agents/elph/attachments/.

Types

This section is empty.

Jump to

Keyboard shortcuts

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