How to create ByteImage object and pass to pHash library in C#

42 views Asked by At

I'm using pHash library to compare images in my app. It works well, however, the library is tightly coupled to platform dependent types, such as System.Drawing.Bitmap or System.Windows.Media.Imaging.BitmapSource.

pHash library has few extensions methods ToLuminanceImage() which create ByteImage object and pass to pHash. All extensions use Bitmap type under the hood.

Official example:

var bitmap = (Bitmap)Image.FromFile(fullPathToImage);
IByteImage byteImage = bitmap.ToLuminanceImage();

// I want to create ByteImage here without using platform dependent types like Bitmap

var hash = ImagePhash.ComputeDigest(byteImage);

Is there a way to use cross-platform library (like ImageSharp or so) to create ByteImage manually and pass to the pHash?

Thanks in advance!

0

There are 0 answers