开发者

IHTMLImgElement to byte[]

开发者 https://www.devze.com 2023-03-07 01:21 出处:网络
I am trying to extract image from c# webbrowser control, and return byte array of the same, i have managed to extract image, buy unable to get byte array of the same.

I am trying to extract image from c# webbrowser control, and return byte array of the same, i have managed to extract image, buy unable to get byte array of the same.

H开发者_StackOverflow中文版ow do i get IHTMLImgElement to byte[], cannot find good examples on google, please any suggestions ?

Thank you.


How about just downloading the original?

string imgSrc = htmlImgElement.src;
WebClient web = new WebClient();
byte[] imageData = web.DownloadData(imgSrc);

You may need to convert src to a fullly qualified URL which you can probably get from the webBrowser.Url (?) property.

0

精彩评论

暂无评论...
验证码 换一张
取 消