C# Type to handle images

127 Views Asked by At

I have a system that captures screenshots from different systems and on different ways. These images are used by different clients, e.g. image comparison, OCR, displaying in GUI, logging etc.

Currently I designed my interfaces to use BitmapSource. But that showed difficulties with the dispatcher beeing created each time a BitmapSource was initialized on a thread without dispatcher. Issue Description

Now I am looking for a simple image interchange format that includes the essential information of an image. The special clients will convert this format to their own formats anyway (BitmapSource in WPF GUI, Mat in OpenCVSharp library, Pix in Tesseract OCR ...)

I tend to use Bitmap from System.Drawing namespace now, but this is also complex and somehow tied to Windows Forms. But it has already some conversion features and has loading and saving capabilities. Also, 3rd party libraries tend to offer conversion from Bitmap to their own format.

So is it appropriate to use Bitmap from System.Drawing as an image interchange format in class libraries (working and initializing in threads other than the GUI thread) or should I rather create an own implementation that carries the required information to represent an image? Or is there a simple independent image format already available somewhere?

0

There are 0 best solutions below