我试图从c#webbrowser控件中提取图像,并返回相同的字节数组,但我设法提取了图像,购买了无法获得相同字节数组的东西。
我如何将IHTMLImgElement转换为byte [],无法在Google上找到好的示例,请提出任何建议?
谢谢。
最佳答案
只下载原始文件怎么样?
string imgSrc = htmlImgElement.src;
WebClient web = new WebClient();
byte[] imageData = web.DownloadData(imgSrc);
您可能需要将src转换为完全限定的URL,您可以从webBrowser.Url(?)属性获得该URL。
关于c# - IHTMLImgElement转换为字节[],我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/6070205/