Using the HTMLAgilityPack to write out a new image node, it seems to remove the closing tag of an image, e.g. should be but when you check outer html, has .
There is an option to turn on XML output that makes this issue go away.
var htmlDoc = new HtmlDocument(); htmlDoc.OptionOutputAsXml = true; htmlDoc.LoadHtml(rawHtml);