So, I'm trying to get an image from the webbrowser in C#
and for some reasons every second / third time it does it, it return a blank picture with the right canvas, instead of just getting the image, and I cant just download it, unfortunately thats not possible, so thats why im doing it this way :)
Bitmap bitmap = new Bitmap(webBrowser1.Width, webBrowser1.Height);
webBrowser1.DrawToBitmap(bitmap, new Rectangle(0, 0, webBrowser1.Width, webBrowser1.Height));
Bitmap pic = bitmap.Clone(new Rectangle(711, 431, 873 - 711, 472 - 431), bitmap.PixelFormat);
pic.Save("image.png");
pic.Dispose();
bitmap.Dispose();