images

package
v0.0.0-...-aa30a3e Latest Latest
Warning

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

Go to latest
Published: Mar 12, 2026 License: MIT Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Imager_Render_FullMethodName      = "/images.Imager/Render"
	Imager_RenderBytes_FullMethodName = "/images.Imager/RenderBytes"
)

Variables

View Source
var File_images_images_proto protoreflect.FileDescriptor
View Source
var Imager_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "images.Imager",
	HandlerType: (*ImagerServer)(nil),
	Methods:     []grpc.MethodDesc{},
	Streams: []grpc.StreamDesc{
		{
			StreamName:    "Render",
			Handler:       _Imager_Render_Handler,
			ServerStreams: true,
		},
		{
			StreamName:    "RenderBytes",
			Handler:       _Imager_RenderBytes_Handler,
			ServerStreams: true,
		},
	},
	Metadata: "images/images.proto",
}

Imager_ServiceDesc is the grpc.ServiceDesc for Imager service. It's only intended for direct use with grpc.RegisterService, and not to be introspected or modified (even as a copy)

Functions

func Frames

func Frames() ([]string, error)

Frames decodes and returns all ASCII art frames.

func Play

func Play(loops int) error

Play prints the accretion disk animation.

func RegisterImagerServer

func RegisterImagerServer(s grpc.ServiceRegistrar, srv ImagerServer)

Types

type Frame

type Frame struct {

	// The ASCII art for this frame, including ANSI color codes if requested.
	Data string `protobuf:"bytes,1,opt,name=data,proto3" json:"data,omitempty"`
	// Frame index (0-based).
	Index int32 `protobuf:"varint,2,opt,name=index,proto3" json:"index,omitempty"`
	// Total number of frames (may be 1 for static images).
	Total int32 `protobuf:"varint,3,opt,name=total,proto3" json:"total,omitempty"`
	// contains filtered or unexported fields
}

func (*Frame) Descriptor deprecated

func (*Frame) Descriptor() ([]byte, []int)

Deprecated: Use Frame.ProtoReflect.Descriptor instead.

func (*Frame) GetData

func (x *Frame) GetData() string

func (*Frame) GetIndex

func (x *Frame) GetIndex() int32

func (*Frame) GetTotal

func (x *Frame) GetTotal() int32

func (*Frame) ProtoMessage

func (*Frame) ProtoMessage()

func (*Frame) ProtoReflect

func (x *Frame) ProtoReflect() protoreflect.Message

func (*Frame) Reset

func (x *Frame) Reset()

func (*Frame) String

func (x *Frame) String() string

type ImagerClient

type ImagerClient interface {
	// Render takes a local path or remote URL to an image/video and
	// returns a stream of ASCII art frames.
	Render(ctx context.Context, in *RenderRequest, opts ...grpc.CallOption) (grpc.ServerStreamingClient[Frame], error)
	// RenderBytes accepts raw file bytes (for when the caller already
	// has the data) and returns ASCII art frames.
	RenderBytes(ctx context.Context, in *RenderBytesRequest, opts ...grpc.CallOption) (grpc.ServerStreamingClient[Frame], error)
}

ImagerClient is the client API for Imager service.

For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.

Imager converts images, GIFs, videos (webm/mp4), and webp files into colored ASCII art frames.

func NewImagerClient

func NewImagerClient(cc grpc.ClientConnInterface) ImagerClient

type ImagerServer

type ImagerServer interface {
	// Render takes a local path or remote URL to an image/video and
	// returns a stream of ASCII art frames.
	Render(*RenderRequest, grpc.ServerStreamingServer[Frame]) error
	// RenderBytes accepts raw file bytes (for when the caller already
	// has the data) and returns ASCII art frames.
	RenderBytes(*RenderBytesRequest, grpc.ServerStreamingServer[Frame]) error
	// contains filtered or unexported methods
}

ImagerServer is the server API for Imager service. All implementations must embed UnimplementedImagerServer for forward compatibility.

Imager converts images, GIFs, videos (webm/mp4), and webp files into colored ASCII art frames.

func NewImagerServer

func NewImagerServer() ImagerServer

type Imager_RenderBytesClient

type Imager_RenderBytesClient = grpc.ServerStreamingClient[Frame]

This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name.

type Imager_RenderBytesServer

type Imager_RenderBytesServer = grpc.ServerStreamingServer[Frame]

This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name.

type Imager_RenderClient

type Imager_RenderClient = grpc.ServerStreamingClient[Frame]

This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name.

type Imager_RenderServer

type Imager_RenderServer = grpc.ServerStreamingServer[Frame]

This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name.

type RenderBytesRequest

type RenderBytesRequest struct {

	// Raw file contents.
	Data []byte `protobuf:"bytes,1,opt,name=data,proto3" json:"data,omitempty"`
	// File extension hint (e.g. ".webm", ".gif", ".png") so we know
	// how to decode it.
	Format string `protobuf:"bytes,2,opt,name=format,proto3" json:"format,omitempty"`
	// Same options as RenderRequest.
	Width      int32   `protobuf:"varint,3,opt,name=width,proto3" json:"width,omitempty"`
	Height     int32   `protobuf:"varint,4,opt,name=height,proto3" json:"height,omitempty"`
	Fps        int32   `protobuf:"varint,5,opt,name=fps,proto3" json:"fps,omitempty"`
	MaxSeconds float32 `protobuf:"fixed32,6,opt,name=max_seconds,json=maxSeconds,proto3" json:"max_seconds,omitempty"`
	Color      bool    `protobuf:"varint,7,opt,name=color,proto3" json:"color,omitempty"`
	Invert     bool    `protobuf:"varint,8,opt,name=invert,proto3" json:"invert,omitempty"`
	// contains filtered or unexported fields
}

func (*RenderBytesRequest) Descriptor deprecated

func (*RenderBytesRequest) Descriptor() ([]byte, []int)

Deprecated: Use RenderBytesRequest.ProtoReflect.Descriptor instead.

func (*RenderBytesRequest) GetColor

func (x *RenderBytesRequest) GetColor() bool

func (*RenderBytesRequest) GetData

func (x *RenderBytesRequest) GetData() []byte

func (*RenderBytesRequest) GetFormat

func (x *RenderBytesRequest) GetFormat() string

func (*RenderBytesRequest) GetFps

func (x *RenderBytesRequest) GetFps() int32

func (*RenderBytesRequest) GetHeight

func (x *RenderBytesRequest) GetHeight() int32

func (*RenderBytesRequest) GetInvert

func (x *RenderBytesRequest) GetInvert() bool

func (*RenderBytesRequest) GetMaxSeconds

func (x *RenderBytesRequest) GetMaxSeconds() float32

func (*RenderBytesRequest) GetWidth

func (x *RenderBytesRequest) GetWidth() int32

func (*RenderBytesRequest) ProtoMessage

func (*RenderBytesRequest) ProtoMessage()

func (*RenderBytesRequest) ProtoReflect

func (x *RenderBytesRequest) ProtoReflect() protoreflect.Message

func (*RenderBytesRequest) Reset

func (x *RenderBytesRequest) Reset()

func (*RenderBytesRequest) String

func (x *RenderBytesRequest) String() string

type RenderRequest

type RenderRequest struct {

	// Local file path or remote URL (http/https).
	Source string `protobuf:"bytes,1,opt,name=source,proto3" json:"source,omitempty"`
	// Desired ASCII art width in characters. 0 = auto (fit terminal).
	Width int32 `protobuf:"varint,2,opt,name=width,proto3" json:"width,omitempty"`
	// Desired ASCII art height in characters. 0 = auto (derive from width).
	Height int32 `protobuf:"varint,3,opt,name=height,proto3" json:"height,omitempty"`
	// For videos/GIFs: frames per second to extract. 0 = default (10).
	Fps int32 `protobuf:"varint,4,opt,name=fps,proto3" json:"fps,omitempty"`
	// For videos/GIFs: max duration in seconds to process. 0 = all.
	MaxSeconds float32 `protobuf:"fixed32,5,opt,name=max_seconds,json=maxSeconds,proto3" json:"max_seconds,omitempty"`
	// Use color ANSI output. Default true.
	Color bool `protobuf:"varint,6,opt,name=color,proto3" json:"color,omitempty"`
	// Invert brightness.
	Invert bool `protobuf:"varint,7,opt,name=invert,proto3" json:"invert,omitempty"`
	// contains filtered or unexported fields
}

func (*RenderRequest) Descriptor deprecated

func (*RenderRequest) Descriptor() ([]byte, []int)

Deprecated: Use RenderRequest.ProtoReflect.Descriptor instead.

func (*RenderRequest) GetColor

func (x *RenderRequest) GetColor() bool

func (*RenderRequest) GetFps

func (x *RenderRequest) GetFps() int32

func (*RenderRequest) GetHeight

func (x *RenderRequest) GetHeight() int32

func (*RenderRequest) GetInvert

func (x *RenderRequest) GetInvert() bool

func (*RenderRequest) GetMaxSeconds

func (x *RenderRequest) GetMaxSeconds() float32

func (*RenderRequest) GetSource

func (x *RenderRequest) GetSource() string

func (*RenderRequest) GetWidth

func (x *RenderRequest) GetWidth() int32

func (*RenderRequest) ProtoMessage

func (*RenderRequest) ProtoMessage()

func (*RenderRequest) ProtoReflect

func (x *RenderRequest) ProtoReflect() protoreflect.Message

func (*RenderRequest) Reset

func (x *RenderRequest) Reset()

func (*RenderRequest) String

func (x *RenderRequest) String() string

type UnimplementedImagerServer

type UnimplementedImagerServer struct{}

UnimplementedImagerServer must be embedded to have forward compatible implementations.

NOTE: this should be embedded by value instead of pointer to avoid a nil pointer dereference when methods are called.

func (UnimplementedImagerServer) Render

func (UnimplementedImagerServer) RenderBytes

type UnsafeImagerServer

type UnsafeImagerServer interface {
	// contains filtered or unexported methods
}

UnsafeImagerServer may be embedded to opt out of forward compatibility for this service. Use of this interface is not recommended, as added methods to ImagerServer will result in compilation errors.

Directories

Path Synopsis
generate: extracts frames from disk.webm and converts them to ASCII art, then writes a Go source file with the embedded frame data.
generate: extracts frames from disk.webm and converts them to ASCII art, then writes a Go source file with the embedded frame data.

Jump to

Keyboard shortcuts

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