SkillAgentSearch skills...

Verify.ImageHash

Extends Verify to allow comparison of images via ImageHash.

Install / Use

/learn @VerifyTests/Verify.ImageHash
About this skill

Quality Score

0/100

Supported Platforms

Universal

README

<img src="/src/icon.png" height="30px"> Verify.ImageHash

Discussions Build status NuGet Status

Extends Verify to allow comparison of images via ImageHash.<!-- singleLineInclude: intro. path: /docs/intro.include.md -->

See Milestones for release notes.

Contains comparers for png, jpg, and bmp.

Sponsors

Entity Framework Extensions<!-- include: sponsors. path: /docs/sponsors.include.md -->

Entity Framework Extensions is a major sponsor and is proud to contribute to the development this project.

Entity Framework Extensions

Developed using JetBrains IDEs

JetBrains logo.<!-- endInclude -->

NuGet

  • https://nuget.org/packages/Verify.ImageHash

Usage

<!-- snippet: enable -->

<a id='snippet-enable'></a>

[ModuleInitializer]
public static void Init() =>
    VerifyImageHash.Initialize();

<sup><a href='/src/Tests/ModuleInitializer.cs#L3-L9' title='Snippet source file'>snippet source</a> | <a href='#snippet-enable' title='Start of snippet'>anchor</a></sup>

<!-- endSnippet -->

Image Comparers

The following will use ImageHash to compare the images instead of the default DifferenceHash algorithm.

<!-- snippet: CompareImage -->

<a id='snippet-CompareImage'></a>

[Test]
public Task CompareImage() =>
    VerifyFile("sample.jpg");

<sup><a href='/src/Tests/Samples.cs#L6-L12' title='Snippet source file'>snippet source</a> | <a href='#snippet-CompareImage' title='Start of snippet'>anchor</a></sup>

<!-- endSnippet -->

Register all comparers

All comparers can be registered:

VerifyImageHash.RegisterComparers();

Use specific threshold

<!-- snippet: CompareImageThreshold -->

<a id='snippet-CompareImageThreshold'></a>

[Test]
public Task CompareImageThreshold() =>
    VerifyFile("sample.jpg")
        .UseImageHash(threshold: 85);

<sup><a href='/src/Tests/Samples.cs#L14-L21' title='Snippet source file'>snippet source</a> | <a href='#snippet-CompareImageThreshold' title='Start of snippet'>anchor</a></sup>

<!-- endSnippet -->

Use specific algorithm

<!-- snippet: CompareImageAlgorithm -->

<a id='snippet-CompareImageAlgorithm'></a>

[Test]
public Task CompareImageAlgorithm() =>
    VerifyFile("sample.jpg")
        .UseImageHash(algorithm: new PerceptualHash());

<sup><a href='/src/Tests/Samples.cs#L23-L30' title='Snippet source file'>snippet source</a> | <a href='#snippet-CompareImageAlgorithm' title='Start of snippet'>anchor</a></sup>

<!-- endSnippet -->

Icon

Swirl designed by Philipp Petzka from The Noun Project.

Related Skills

View on GitHub
GitHub Stars9
CategoryDevelopment
Updated1d ago
Forks1

Languages

C#

Security Score

85/100

Audited on Apr 3, 2026

No findings