[英]How to create stream image in Angle Sharp
我需要從IHtmlImageElement
創建一個流圖像。
在HtmlUnit
,我使用的是:
HtmlImage image;
ImageReader reader = image.getImageReader();
那么,我怎樣才能在AngleSharp
做到這AngleSharp
?
AngleSharp僅知道存在帶有src
屬性的img
元素之類的東西-它沒有圖像流(開箱即用)。
也可以完全獨立於AngleSharp來獲取圖像流(有關詳細信息,請參見https://github.com/AngleSharp/AngleSharp/blob/master/doc/Questions.md#how-to-download-a-picture )。
現在,如果要獲取圖像的src
,請執行以下操作
var src = document.QuerySelector<IHtmlImageElement>("img#my-awesome-img-element").Source;
其中document
是文檔( IHtmlDocument
)實例,而#my-awesome-img-element
是圖像元素的ID。 您可以根據需要選擇任何CSS選擇器。
希望有幫助!
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.