[英]How to convert pixel byte array to bitmap image in windows phone 8
[英]How to convert Image to Bitmap or Byte Array
我想把一個Image翻譯成一個MemoryStream或者一個字節數組,但是這不起作用,我以前在Windows Forms中翻譯的方式和我在Xamarin.Forms中的翻譯方式一樣嗎?
MemoryStream ms = new MemoryStream();
img.Save(ms, img.Image.RawFormat);
byte[] byteimg = ms.ToArray();
Unlike Windows.Forms or WPF where the Image class has direct access to pixels and can provide the entirety of image manipulation APIs, Image class in Xamarin Forms is just an abstraction for multiple platform views across OSes (Android, iOS, macOS etc.) It provides limited與任何平台控件相比的功能,主要任務是創建平台視圖,從預定義源之一(嵌入式資源、文件、字節 stream 等)加載圖片,將其放置在可視化樹中的某個位置。 就是這樣,XF Image class 不負責低級像素操作,也不提供對原始圖像的實際位數據的訪問。 你不會找到讓你訪問像素的方法,因此不允許你從加載到 memory 字節的數據中創建 Stream。
為了訪問單個字節,您可以:
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.