Expand description
Image processing utilities
Re-exports from vtcode-commons::image plus URL-based image fetching.
Structs§
- Image
Data - Represents the data from an image file ready for LLM consumption
Constants§
- MAX_
IMAGE_ FILE_ BYTES - Maximum accepted image file size (20 MB).
- SUPPORTED_
IMAGE_ EXTENSIONS - File extensions that map to
SUPPORTED_IMAGE_MIME_TYPES. - SUPPORTED_
IMAGE_ MIME_ TYPES - Image MIME types accepted by LLM vision APIs.
- UNSUPPORTED_
BINARY_ IMAGE_ EXTENSIONS - Binary raster extensions no LLM vision API accepts.
Functions§
- detect_
mime_ type_ from_ content_ type - Detects MIME type from Content-Type header.
- detect_
mime_ type_ from_ data - Detects MIME type from file data (magic bytes)
- encode_
to_ base64 - Encodes binary data to base64
- has_
supported_ image_ extension - Validates that the image file path has a provider-supported extension.
- is_
supported_ image_ mime_ type - Returns whether a MIME type can be sent to LLM vision APIs.
- read_
image_ file - Reads an image file from the local filesystem and converts it to base64 format.
- read_
image_ file_ any_ path - Reads an image file from an absolute path (or already validated path) and converts it to base64.
- read_
image_ from_ url - Reads an image from a URL and converts it to base64 format