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