image

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jul 7, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

Package image loads a local image file into the base64 form the model providers expect, downscaling oversized PNG and JPEG images so a phone-sized screenshot does not blow the token budget.

Index

Constants

View Source
const MaxBytes = 8 << 20 // 8 MiB

MaxBytes caps the encoded payload so a huge file cannot be attached by mistake. It applies to formats we do not re-encode (GIF, WebP).

View Source
const MaxDim = 1568

MaxDim is the longest edge, in pixels, kept after downscaling. It matches the size above which the Anthropic API resizes anyway, so sending more is waste.

Variables

This section is empty.

Functions

func IsImagePath

func IsImagePath(path string) bool

IsImagePath reports whether a path looks like an image by extension. The TUI uses it to decide whether an @mention should attach rather than inline.

func Load

func Load(path string) (mediaType, data string, err error)

Load reads an image file and returns its MIME type and standard-base64 data, ready for provider.Image. PNG and JPEG larger than MaxDim on a side are downscaled and re-encoded; other formats pass through, subject to MaxBytes.

Types

This section is empty.

Jump to

Keyboard shortcuts

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