I have here existing code that I need to fix because for unknown reasons, our .dll files were probably replaced.
I am having problems on using the image for OCR (Python Tesseract). Below is the how the code works:
ImageConverter ic = new ImageConverter();
byte[] imgArray = (byte[])ic.ConvertTo(image, typeof(byte[]));
I am passing the image to make it into byte[] then pass it on the API. Then the API converts the array to image:
public Bitmap ConvertToImage(byte[] arr)
{
using (var ms = new MemoryStream(arr))
{
return new Bitmap(ms);
}
}
As an example, when I use Bitmap img2 = ConvertToImage(imgArray);
, it gives me the error
I only get the GDI error when I try to use the image from the converted array. But when I use the straight image file (open file dialog) there seems to be no problem. I can't really change the code, so can anyone suggest a solution? Or what's the problem when I used the array to image file?