imageio

package
v0.209.0 Latest Latest
Warning

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

Go to latest
Published: Nov 8, 2026 License: Apache-2.0 Imports: 5 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package imageio loads a local image (or validates a data URI) into a data:image/...;base64,... URI for the multimodal vision path. It NEVER fetches a remote URL — only local files and pre-built data URIs are accepted.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LoadImageB64

func LoadImageB64(pathOrDataURI string, maxBytes int) (string, error)

LoadImageB64 returns a data:image/<type>;base64,<...> URI for pathOrDataURI.

  • If the arg is already a data: URI, it is validated to be an image/* base64 URI and returned unchanged (rejected otherwise).
  • If it looks like an http(s) URL, it is rejected — remote fetches are never allowed.
  • Otherwise it is treated as a local file path: read (rejected if larger than maxBytes), type-sniffed from magic bytes (PNG/JPEG/WebP/GIF), and base64-encoded into a data URI. An unknown type is rejected.

maxBytes <= 0 means "no size limit" (the file is read whatever its size).

Types

This section is empty.

Jump to

Keyboard shortcuts

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