Hi, here is how you can do that:
var htmlDocument = new HtmlWeb().Load("URL of website you are targeting...");
var imageNode = htmlDocument.DocumentNode.SelectSingleNode("XPath of image you are targeting...");
string imagePath = imageNode.Attributes["src"].Value;
var imageStream = HttpWebRequest.Create(imagePath).GetResponse().GetResponseStream();
this.pictureBox1.Image = Image.FromStream(imageStream);
Now I need to point out one thing regarding the
imagePath
, in the snippet above I just read the image's
src
attribute and create a web request for it, but in reality it is more likely that the image's
src
attribute will contain relative path so in that case you would need to make that
imagePath
into an absolute path because otherwise
HttpWebRequest.Create(imagePath)
will fail.