Versions in this module Expand all Collapse all v1 v1.0.0 Aug 28, 2026 Changes in this version + const MaxNameLength + const MaxScale + const MaxTextLength + const MaxWatermarkLength + var ErrAPI = errors.New("API error") + var ErrAsset = errors.New("asset error") + var ErrFont = errors.New("font error") + var ErrRender = errors.New("render error") + var ErrValidation = errors.New("validation error") + func Encode(w io.Writer, img image.Image, opts EncodeOptions) error + func EncodeBytes(img image.Image, opts EncodeOptions) ([]byte, error) + func EncodeDataURL(img image.Image, opts EncodeOptions) (string, error) + func MIMEType(format Format) (string, error) + type AssetError struct + Err error + Source string + func (e *AssetError) Error() string + func (e *AssetError) Unwrap() error + type AvatarSizeAxis string + const AvatarNativeHeight + const AvatarNativeWidth + type ConversationMessage struct + Avatar ImageSource + DisplayName string + Text string + Username string + type ConversationOptions struct + Misskey MisskeyOptions + OnAssetError MissingAssetBehavior + Theme ConversationTheme + Width int + type ConversationTheme string + const ConversationDark + const ConversationLight + type EncodeOptions struct + Format Format + Quality int + type Engine struct + func NewEngine(opts EngineOptions) (*Engine, error) + func (e *Engine) RenderConversation(ctx context.Context, messages []ConversationMessage, ...) (*image.NRGBA, error) + func (e *Engine) RenderQuote(ctx context.Context, quote Quote, opts RenderOptions) (*image.NRGBA, error) + func (e *Engine) WriteConversation(ctx context.Context, w io.Writer, messages []ConversationMessage, ...) error + func (e *Engine) WriteQuote(ctx context.Context, w io.Writer, quote Quote, opts RenderOptions, ...) error + type EngineOptions struct + AllowPrivateNetwork bool + DisableAutoFont bool + DisableImageCache bool + FontCacheDir string + Fonts []FontFace + HTTPClient *http.Client + ImageCacheEntries int + ImageCacheTTL time.Duration + ImageFailureTTL time.Duration + MaxAssetBytes int64 + MaxImagePixels int64 + Offline bool + StrictFonts bool + TwemojiCacheDir string + type FieldError struct + Err error + Field string + func (e *FieldError) Error() string + func (e *FieldError) Unwrap() error + type FontFace struct + Data []byte + Family string + type Format string + const AVIF + const JPEG + const JPG + const PNG + const WebP + func CanonicalFormat(format Format) (Format, error) + type ImageSource interface + func ImageBytes(b []byte) ImageSource + func ImageFile(path string) ImageSource + func ImageURL(value *url.URL) ImageSource + func ImageValue(value image.Image) ImageSource + type MissingAssetBehavior string + const AssetAsText + const AssetIgnore + const AssetThrow + type MisskeyOptions struct + Instances []string + Remote *bool + type Quote struct + Avatar ImageSource + DisplayName string + Text string + Username string + Watermark string + type RenderOptions struct + BackgroundFit theme.Fit + BackgroundImage ImageSource + BackgroundOpacity *float64 + Misskey MisskeyOptions + OnAssetError MissingAssetBehavior + Scale float64 + SizeToAvatar AvatarSizeAxis + Theme theme.Input