DuplaImage.Lib is a .NET standard library offering several different perceptual hashing algorithms for detecting similar or duplicate images.
$ dotnet add package DuplaImage.Lib
DuplaImage.LibDuplaImage.Lib is a .NET standard library offering several different perceptual hashing algorithms for detecting similar or duplicate images.
DuplaImage.Lib is available as a Nuget package. You can laso donwload the Nuget packages from the releases page.
DuplaImage.Lib implements the following perceptual hash algorithms:
All algorithms accepts the image input as a stream or as a path to filesystem location.
DuplaImage.Lib also provides a function to compare hashes to return the similarity of the hashes.
DuplaImage.Lib uses Magick.NET for image processing needs. Users of DupImageLib can use their own image processing library by providing an implementation of IImageTransformer and passing that to the ImageHashes constructor.
// Create new ImageHashes instance using ImageMackick as image manipulation library
ImageHashes ImageHasher = new ImageHashes(new ImageMagickTransformer());
// Calculate 64 bit hashes for the images using difference algorithm
long Hash1 = imageHasher.CalculateDifferenceHash64(@"testimage1.png");
long Hash2 = imageHasher.CalculateDifferenceHash64(@"testimage2.png");
// Calculate similarity between the hashes. Score of 1.0 indicates identical images.
float similarity = ImageHashes.CompareHashes(hash1, hash2);
This software is licensed under Apache 2.0 license. See LICENSE file for more information.