image

package
v0.0.25 Latest Latest
Warning

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

Go to latest
Published: Jan 13, 2026 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CopyToClipboard

func CopyToClipboard(imagePath string, imageData []byte) error

CopyToClipboard copies image to clipboard (platform-aware) Attempts to copy actual image data, not just the path

func DisplayImage

func DisplayImage(imagePath string) error

DisplayImage displays the image in terminal using icat if available Returns nil if icat is not available or fails (display is non-critical)

func ReadFromClipboard

func ReadFromClipboard() ([]byte, error)

ReadFromClipboard reads image data from the system clipboard Returns the image data and an error if clipboard doesn't contain an image

func SaveImage

func SaveImage(data []byte, outputDir, prompt string) (string, error)

SaveImage saves image data to the configured output directory Returns the path where the image was saved

Types

type EditRequest

type EditRequest struct {
	Prompt     string
	InputImage []byte // Input image data
	InputPath  string // Path for MIME type detection
	Debug      bool
}

EditRequest contains parameters for image editing

type FluxProvider

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

FluxProvider implements ImageProvider using Black Forest Labs' Flux API

func NewFluxProvider

func NewFluxProvider(apiKey, model string) *FluxProvider

func (*FluxProvider) Edit

func (p *FluxProvider) Edit(ctx context.Context, req EditRequest) (*ImageResult, error)

func (*FluxProvider) Generate

func (p *FluxProvider) Generate(ctx context.Context, req GenerateRequest) (*ImageResult, error)

func (*FluxProvider) Name

func (p *FluxProvider) Name() string

func (*FluxProvider) SupportsEdit

func (p *FluxProvider) SupportsEdit() bool

type GeminiProvider

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

GeminiProvider implements ImageProvider using Google's Gemini API

func NewGeminiProvider

func NewGeminiProvider(apiKey string) *GeminiProvider

func (*GeminiProvider) Edit

func (*GeminiProvider) Generate

func (p *GeminiProvider) Generate(ctx context.Context, req GenerateRequest) (*ImageResult, error)

func (*GeminiProvider) Name

func (p *GeminiProvider) Name() string

func (*GeminiProvider) SupportsEdit

func (p *GeminiProvider) SupportsEdit() bool

type GenerateRequest

type GenerateRequest struct {
	Prompt string
	Debug  bool
}

GenerateRequest contains parameters for image generation

type ImageProvider

type ImageProvider interface {
	// Name returns the provider name for logging
	Name() string

	// Generate creates a new image from a text prompt
	Generate(ctx context.Context, req GenerateRequest) (*ImageResult, error)

	// Edit modifies an existing image based on a prompt
	Edit(ctx context.Context, req EditRequest) (*ImageResult, error)

	// SupportsEdit returns true if the provider supports image editing
	SupportsEdit() bool
}

ImageProvider is the interface for image generation providers

func NewImageProvider

func NewImageProvider(cfg *config.Config, providerOverride string) (ImageProvider, error)

NewImageProvider creates an image provider based on config

type ImageResult

type ImageResult struct {
	Data     []byte // Image data (PNG/JPEG)
	MimeType string // "image/png", "image/jpeg", etc.
}

ImageResult contains the generated image and metadata

type OpenAIProvider

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

OpenAIProvider implements ImageProvider using OpenAI's API

func NewOpenAIProvider

func NewOpenAIProvider(apiKey string) *OpenAIProvider

func (*OpenAIProvider) Edit

func (*OpenAIProvider) Generate

func (p *OpenAIProvider) Generate(ctx context.Context, req GenerateRequest) (*ImageResult, error)

func (*OpenAIProvider) Name

func (p *OpenAIProvider) Name() string

func (*OpenAIProvider) SupportsEdit

func (p *OpenAIProvider) SupportsEdit() bool

type OpenRouterProvider added in v0.0.24

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

OpenRouterProvider implements ImageProvider using OpenRouter's API

func NewOpenRouterProvider added in v0.0.24

func NewOpenRouterProvider(apiKey, model string) *OpenRouterProvider

func (*OpenRouterProvider) Edit added in v0.0.24

func (*OpenRouterProvider) Generate added in v0.0.24

func (*OpenRouterProvider) Name added in v0.0.24

func (p *OpenRouterProvider) Name() string

func (*OpenRouterProvider) SupportsEdit added in v0.0.24

func (p *OpenRouterProvider) SupportsEdit() bool

Jump to

Keyboard shortcuts

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