Skip to main content

Class: PixelDiffer

mugshot.PixelDiffer

Compare screenshots pixel by pixel using pixelmatch.

Images with different dimensions will always fail comparison and a diff indicating the extra region will be returned. The images will be overlaid starting from the top left corner and then compared. All of the pixels that are outside of the intersection will be considered different, no matter the threshold.

pixel-differ-explanation

See the examples below to understand how images with different sizes will be compared.

pixel-differ-examples

Implements#

Constructors#

constructor#

+ new PixelDiffer(__namedParameters?: PixelDifferOptions): PixelDiffer

Parameters:#

NameTypeDefault valueDescription
__namedParametersPixelDifferOptions{}PixelDifferOptions

Returns: PixelDiffer

Defined in: packages/mugshot/src/lib/pixel-differ.ts:54

Methods#

compare#

compare(expected: Buffer, actual: Buffer): Promise<DiffResult>

Parameters:#

NameType
expectedBuffer
actualBuffer

Returns: Promise<DiffResult>

Implementation of: PNGDiffer.compare

Defined in: packages/mugshot/src/lib/pixel-differ.ts:67