Extract image in the WebBrowser control?  
Author Message
Eric Chow





PostPosted: Visual C# General, Extract image in the WebBrowser control? Top

Hello,

Is it possible to extract all the images that showed in the WebBrowser control into files

Best regards,

Eric



Visual C#2  
 
 
ahmedilyas





PostPosted: Visual C# General, Extract image in the WebBrowser control? Top

not entirely. why dont you just use the ShowSaveAsDialog() in the webbrowser control to save the document to disk

if you need the images, you need to go through each element/tag and get that image and perhaps use httpwebrequest/webresponse class to download that image and save it. Maybe use something like Document.GetElementsByTagName("img"), which returns an HtmlElementCollection of tags, then go through each one and check either the inner/outerhtml text or something to obtain the url.

to make life a bit simpler, once you get the tag/image link, load it into a picturebox then save it to disk.

thePictureBox.Load(url);

thePictureBox.Image.Save(filename);