0

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();

Edited by Jazerix: n/a

2
Contributors
2
Replies
4
Views
5 Years
Discussion Span
Last Post by Jazerix
0

If you want to download image which is accessed thru webbrowser. There is some easiest way to do it. If you view any image in webbrower control, it will cached locally your machine. You just need to find the correct path, make a clone and finally save it in your required folder.

There is some method called FindUrlCacheEntries to retrieve local temp image path. But i don't know which dll :)

0

If you want to download image which is accessed thru webbrowser. There is some easiest way to do it. If you view any image in webbrower control, it will cached locally your machine. You just need to find the correct path, make a clone and finally save it in your required folder.

There is some method called FindUrlCacheEntries to retrieve local temp image path. But i don't know which dll :)

Thank you! Ill look into it right away :D!

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.