image

package
v0.40.0 Latest Latest
Warning

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

Go to latest
Published: Sep 24, 2026 License: MIT Imports: 18 Imported by: 0

Documentation

Overview

Package image derives WebP variants, public slots and zip downloads with libvips (CGO). A Processor runs one media.ProcessJob: it fills an item's missing or stale variants in one manifest edit and re-encodes its public slots. Originals are read, never served.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Store     media.Store
	Kinds     *media.Registry
	Manifests *media.Manifests
	Specs     SpecChooser
	Hooks     media.Hooks // Failed
	Workers   int         // sources encoded at once; default 2
	MaxPixels int         // largest source decoded, all frames of an animation together; default 100 MP
	MaxFrames int         // frames an animation may have; default 1000
	// MaxAnimationSeconds bounds an animation's running time; default 60.
	MaxAnimationSeconds float64
	TempDir             string // zip scratch; default os.TempDir()
}

Config configures a Processor.

type Processor

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

Processor derives images. It is safe for concurrent use and idempotent: a variant of an unchanged source and spec is never recomputed.

func New

func New(c Config) (*Processor, error)

func (*Processor) Process

func (p *Processor) Process(ctx context.Context, job media.ProcessJob) error

Process runs one job: a Slot job re-encodes that slot or inline image; otherwise the ref's manifest (when the ref addresses one), every uploaded slot and every inline image are brought up to date.

type SpecChooser

type SpecChooser func(kind media.Kind, f media.File) map[string]media.Spec

SpecChooser returns the variants a file gets, by name: a host's per-file choice such as taller manhwa pages or a blurred teaser. The default is the kind's Specs.

Jump to

Keyboard shortcuts

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