kitty

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jan 1, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const ChunkSize = 4096

ChunkSize is the maximum size of each base64 chunk in the Kitty protocol.

Variables

This section is empty.

Functions

func Encode

func Encode(w io.Writer, img image.Image) error

Encode writes an image to w using Kitty graphics protocol.

Types

type Encoder

type Encoder struct {
	// contains filtered or unexported fields
}

Encoder encodes images using the Kitty graphics protocol.

func NewEncoder

func NewEncoder(opts ...Option) *Encoder

NewEncoder creates a new Encoder with the given options.

func (*Encoder) Encode

func (e *Encoder) Encode(w io.Writer, img image.Image) error

Encode writes an image to w using Kitty graphics protocol. The image is encoded as PNG before transmission. Protocol spec: https://sw.kovidgoyal.net/kitty/graphics-protocol/

type Option

type Option func(*Encoder)

Option configures an Encoder.

func WithOnAfterEncode

func WithOnAfterEncode(fn func()) Option

WithOnAfterEncode sets the callback called after encoding completes.

func WithOnAfterEncodeChunk

func WithOnAfterEncodeChunk(fn func(chunkIndex int, isLast bool)) Option

WithOnAfterEncodeChunk sets the callback called after each chunk is encoded.

func WithOnBeforeEncode

func WithOnBeforeEncode(fn func()) Option

WithOnBeforeEncode sets the callback called before encoding starts.

func WithOnBeforeEncodeChunk

func WithOnBeforeEncodeChunk(fn func(chunkIndex int, isLast bool)) Option

WithOnBeforeEncodeChunk sets the callback called before each chunk is encoded.

Jump to

Keyboard shortcuts

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