Skip to content
This repository has been archived by the owner on Nov 20, 2021. It is now read-only.

Codeuctivity/System.Drawing.Compare

Repository files navigation

BitmapCompare

Codacy Badge Build status Nuget

What does BitmapCompare do? It compares images

Inspired by the image compare feature "Visual verification API" of TestApi this code supports comparing images by using a tolerance mask image. That tolerance mask image is a valid image by itself and can be manipulated.

BitmapCompare focus on OS independent support and depends on System.Drawing. It is planned to be semi compatible with ImageSharp.Compare. Expect different error values when using lossy compression formats, lossless formats result in same errors for now. BitmapCompare was created because ImageSharp changed their license to AGPL.

Example show case

Imagine two images you want to compare, and want to accept the found difference as at state of allowed difference.

Reference Image

actual image

Actual Image

actual image

Tolerance mask image

using "compare.CalcDiff" you can calc a diff mask from actual and reference image

Example - Create difference image

            using var maskImage = Compare.CalcDiffMaskImage(pathPic1, pathPic2);
            maskImage.Save("differenceMask.png");

differenceMask.png

Example - Compare two images using the created difference image. Add white pixels to differenceMask.png where you want to allow difference.

var maskedDiff = Compare.CalcDiff(pathPic1, pathPic2, "differenceMask.png");
Assert.That(maskedDiff.AbsoluteError, Is.EqualTo(0));

Now you can change differenceMask.png with your favorite editor and paint white pixels where you want to ignore difference in your image under test.

About

Adds compare features on top of System.Drawing

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages