imgstat

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Aug 26, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package imgstat inspects extracted screenshots and reports whether they carry any usable content. It implements the Analyzer port of package clipper without depending on it, so the domain stays free of image handling.

Index

Constants

View Source
const (
	DefaultMaxMean   = 0.02
	DefaultMaxStdDev = 0.02
)

Default thresholds for the blank frame heuristic. A frame counts as blank when it is nearly uniform (nothing to see) or nearly black (a fade or a leader).

Variables

View Source
var ErrDecode = errors.New("cannot decode image")

ErrDecode reports an image that cannot be decoded.

Functions

This section is empty.

Types

type Detector

type Detector struct {
	// MaxMean is the highest average luminance still considered black.
	MaxMean float64
	// MaxStdDev is the highest luminance spread still considered uniform.
	MaxStdDev float64
}

Detector decides whether an image is blank. The zero value only rejects perfectly uniform images; use NewDetector for the defaults.

func NewDetector

func NewDetector() Detector

NewDetector returns a Detector with the default thresholds.

func (Detector) Blank

func (d Detector) Blank(path string) (bool, error)

Blank implements the Analyzer port of package clipper.

type Stats

type Stats struct {
	Mean    float64
	StdDev  float64
	Samples int
}

Stats describes the luminance distribution of an image. Mean and StdDev are normalised to the range [0, 1].

func Analyze

func Analyze(r io.Reader) (Stats, error)

Analyze computes the luminance statistics of an encoded image.

func AnalyzeFile

func AnalyzeFile(path string) (Stats, error)

AnalyzeFile computes the luminance statistics of an image file.

Jump to

Keyboard shortcuts

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