Documentation
¶
Overview ¶
Package image handles terminal image preview rendering using the Halfblocks protocol, with LRU caching and graphics protocol detection.
Index ¶
Constants ¶
const ( MaxImageSize = 10 * 1024 * 1024 // 10MB MaxCacheEntries = 20 )
Variables ¶
This section is empty.
Functions ¶
func IsImageFile ¶
IsImageFile checks if path has a supported image extension
func SupportedTerminals ¶
func SupportedTerminals() string
SupportedTerminals returns a string about image preview support
Types ¶
type RenderResult ¶
type RenderResult struct {
Content string // ANSI escape sequences for image
IsFallback bool // True if showing text message
Width int
Height int
}
RenderResult contains rendered output or fallback
type Renderer ¶
type Renderer struct {
// contains filtered or unexported fields
}
Renderer handles image preview rendering
func (*Renderer) CacheStats ¶
CacheStats returns cache statistics for debugging
func (*Renderer) InvalidatePath ¶
InvalidatePath removes cached entries for a specific path
func (*Renderer) Render ¶
func (r *Renderer) Render(path string, maxW, maxH int) (*RenderResult, error)
Render renders an image to terminal graphics using Halfblocks protocol. Halfblocks uses Unicode block characters (▀▄█) with ANSI colors, which integrates properly with TUI frameworks like Bubble Tea. Native protocols (Kitty, iTerm2, Sixel) bypass TUI rendering and write directly to terminal.