snapcmp

package
v0.9.1 Latest Latest
Warning

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

Go to latest
Published: Oct 18, 2026 License: EPL-2.0 Imports: 2 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package snapcmp compares two screenshots with a per-pixel tolerance (stdlib only, no GUI).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Result

type Result struct {
	Differing, Total int
	SizeMismatch     bool
	Diff             image.Image
}

Result of one comparison. Size mismatch is a failure with Diff == nil.

func Compare

func Compare(ref, got image.Image, threshold int) Result

Compare counts pixels whose largest channel delta (0..255) exceeds threshold; Diff shows them in red over a dimmed reference.

func (Result) Fraction

func (r Result) Fraction() float64

Fraction is the share of differing pixels.

func (Result) Within

func (r Result) Within(maxFraction float64) bool

Within reports whether the differing share is at most maxFraction.

Jump to

Keyboard shortcuts

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