png

package
v0.9.1 Latest Latest
Warning

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

Go to latest
Published: Jun 28, 2026 License: MIT Imports: 13 Imported by: 0

Documentation

Overview

Package png renders asciinema cast files to still PNG images.

Index

Constants

This section is empty.

Variables

View Source
var ErrValidation = errors.New("png validation failed")

ErrValidation indicates that a rendered PNG failed validation.

Functions

func Render

func Render(ctx context.Context, castPath, outputPath string, config gif.Config, frame FrameSelection) error

Render converts an asciinema cast file to a still PNG by rendering with agg first and selecting one frame from the produced GIF.

Types

type FrameSelection

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

FrameSelection identifies which frame to snapshot from a rendered GIF.

func ParseFrameSelection

func ParseFrameSelection(value string) (FrameSelection, error)

ParseFrameSelection parses snapshot frame syntax: last, <index>, at:<ms>.

type Renderer

type Renderer struct {
	Frame FrameSelection
}

Renderer renders a cast into a PNG snapshot.

func (Renderer) Render

func (r Renderer) Render(ctx context.Context, castPath, outputPath string, config gif.Config) error

type Validation

type Validation struct {
	Width         int
	Height        int
	PixelVariance int
}

Validation describes a decoded PNG.

func Validate

func Validate(path string) (Validation, error)

Validate decodes a PNG and verifies it has visible image content.

Jump to

Keyboard shortcuts

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